31

This was asked a couple of hours ago:

What is the difference between E:dir(dir) and E[dir="dir"] in CSS?

on which I just left the following comment:

The same reason why a :lang() pseudo exists as opposed to the [lang] attribute selector: What's the difference between html[lang="en"] and html:lang(en) in CSS?

Both questions can be answered almost completely word-for-word with the exact same answer, with either the "lang" or "dir" keywords filled in as appropriate. Were I to answer the "dir" question, pretty much the only thing I would change from my answer to the "lang" question is the quotation of the spec, and the example selectors at the bottom. Except there's a rule of thumb that says that if an answer to one question answers a different question exactly, word for word, then both questions are duplicates.

But are they? The fact that both selectors work so similarly is just a sheer coincidence owing to the nature of the language and directional attributes in HTML. They're still two distinct attributes, and I'm a little iffy about marking one question as a duplicate of the other for that reason. But what's the alternative? Copying my answer to the older question and pasting as new?

12
  • 41
    You should ask a moderat….oh wait
    – Cody Gray Mod
    Commented Jan 3, 2017 at 15:35
  • 1
    Can you not tailor the answers at all?
    – ChrisF Mod
    Commented Jan 3, 2017 at 15:38
  • 20
    "Copying and pasting my answer to the older question as new?" Careful, someone/the system might flag that for a moder... Erm... Nevermind.
    – Kendra
    Commented Jan 3, 2017 at 15:38
  • 1
    @ChrisF: Other than quoting the appropriate section of the spec, and a significant change to only one line of code (with the rest seeing only a replacement of "lang" with "dir"), any amount of tailoring would just be paraphrasing what is effectively the same concept.
    – BoltClock Mod
    Commented Jan 3, 2017 at 15:39
  • Since I have no idea what the questions and answers talk about, and since by reading only your answer I understood the other one, I think they can be easily considered duplicates.
    – Maroun
    Commented Jan 3, 2017 at 16:03
  • 2
    FWIW to me yes, they are dups. I would not say the fact that both selectors work so similarly is "sheer coincidence". They are both pseudo-classes that have a particular relationship to language-related attributes which span subtrees of the DOM and which we want to be able to address on individual elements within those subtrees, and clearly they share a common design principle.
    – user663031
    Commented Jan 3, 2017 at 18:08
  • 2
    @torazaburo: That sounds about right. I could edit my :lang() answer to include a note that :dir() works similarly for that very reason - and then marking the questions as duplicates might feel a little less wrong, just maybe.
    – BoltClock Mod
    Commented Jan 4, 2017 at 3:07
  • I wish I could flag this question a duplicate so that it would make a headline
    – th3pirat3
    Commented Jan 4, 2017 at 17:35
  • @BoltClock I would suggest an edit to your lang answer to include dir as well, then mark as a duplicate.
    – TylerH
    Commented Jan 4, 2017 at 17:43
  • Just a question: I assume moderators have their own private forms of communication for issues such as this, where I assume you could have got an answer. For something like this, do you decide to put it on meta of your own volition or do the moderators 'decide' to put something like this on meta to get the communities opinion?
    – SGR
    Commented Jan 5, 2017 at 13:38
  • The problem here is the adoption of the illogical (and wrong) rule of thumb (read: "myth") that says: "if an answer to one question answers a different question exactly, word for word, then both questions are duplicates." As this answer clearly debunks. At Stack Overflow we should be smarter than this and reject such obviously flawed thinking instead of continuing to accept it without questioning. Commented Jan 5, 2017 at 15:26
  • @SGR: The former in this case.
    – BoltClock Mod
    Commented Jan 5, 2017 at 16:07

5 Answers 5

29

I'm not an expert at advanced CSS selectors, but I think you might have answered your own dilemma by saying:

The fact that both selectors work so similarly is just a sheer coincidence owing to the nature of the language and directional attributes in HTML.

  • If it's a coincidence A works almost exactly like B, then it's not reasonable to expect for someone to think A works virtually exactly like B.
  • Therefore it's not reasonable to expect someone asking about A, to research B beforehand.
  • Therefore the question about A provides value for people who would research A in the future, since they wouldn't think about researching B either.

    This is different from "providing multiple search terms for the same answer" (ie. one of important reasons for the existence of duplicates), because it is not the same answer. You can arrive at duplicate's search terms by using thesaurus or playing with grammar - here not so much.

  • Therefore the question is not a duplicate.
  • something something duplication is in the subject matter not the question something something

Pointing out in the comments or the answer that answers to questions about A and B are coincidentally identical would still be a good idea, though.


What I'm trying to get across, is that - if I understand you correctly - you have arrived at an edge case where the guidelines are at conflict:

  • newer question can be answered with a near copy-paste from older question's answer = DUPLICATE!
  • newer question is not same as the old question but from different perspective and or wording = NOT DUPLICATE

In such situations, I feel one should look at the purpose behind duplicates. I'm neither moderator nor reviewer, but as far as I understand it, duplicates are for:

  • the benefit of answerers - so they don't go mad from answering the same question with the same answer for Nth time, and leave frustrated

  • the benefit of visitors - so they get all relevant information in one single, interlinked glut, will arrive at what they're looking for - regardless of what perspective they have on the problem, and won't have to wade through N grains of sand to find that one pearl

  • the benefit of askers - so they get a slap on the wrist (so they will try better in the future) and luscious, ripe answers without waiting for them - at the same time

If you think marking this edge case as a duplicate is pertinent to these benefits...

... and won't make anyone scratch their head in bewilderment, like this one case where a question asking "Why is X false?" was marked as a duplicate of one with all answers saying "X is always true" ...

...you should probably do so.

8
  • 1
    "Therefore the question about A provides value for people who would research A in the future, since they wouldn't think about researching B either." Isn't providing multiple search terms to point to the same answer the entire point of dupe closing?
    – reirab
    Commented Jan 3, 2017 at 18:54
  • 7
    @reirab it's not that simple, closing as duplicates is more that semantically both questions asks about the same thing, just using different words. "How you put your shoes?" and "In what way do you wear footwear?" can be semantically the same (if for the later it's talking about shoes), but "Why is X this way?" isn't the same as "Why is Y this way?" even if the same answer can be given, as both can have separated reasoning.
    – Braiam
    Commented Jan 3, 2017 at 19:02
  • 1
    @reirab Well, if the multiple search terms are related to a single problem, then sure, but if it's search terms for two different problems, then probably not.
    – Dragomok
    Commented Jan 3, 2017 at 19:04
  • 1
    @Braiam No argument there. I was just talking about the reasoning used in this answer. That people might search for phrase A instead of phrase B is not a valid reason to not close A as a dupe of B. On the contrary, that's the whole point of closing A as a dupe of B as opposed to simply deleting A.
    – reirab
    Commented Jan 3, 2017 at 19:06
  • @reirab as long as semantically speaking A and B are equivalent in all contexts! Or, lets put it another way: just because a hammer can embed nails and screws into wood, "how nail a nail into wood?" and "how to drive a screw into wood?" are not the same questions.
    – Braiam
    Commented Jan 3, 2017 at 19:08
  • 2
    @Braiam Agreed. Like I said, I'm arguing only against the reasoning used in this answer, not suggesting that different questions with similar answers should be dupe-closed.
    – reirab
    Commented Jan 3, 2017 at 19:14
  • @reirab I concur that I have a problem with putting my point across. Fortunately, Braiam managed to do that for me. I've edited my answer.
    – Dragomok
    Commented Jan 3, 2017 at 19:28
  • 3
    Your understanding is correct. Excellent breakdown.
    – BoltClock Mod
    Commented Jan 4, 2017 at 3:14
17

The relationship between "questions" and "answers" is many-to-many. A question may have several distinct correct answers, but also an "answer" may be the correct answer to several distinct questions.

"Duplicate question" should refer to the question itself. Two distinct questions that have the same answer are not necessarily duplicate questions. Two questions are duplicates of each other if one can be transformed into the other through "standard manipulations" (however defined) REGARDLESS of any answer to either question.

Example: What is 3 + 5? What is 2 * 4? Both have the same answer, but they are not duplicates of each other. Compare with: What is 5 + 3? Addition is commutative, so this is a duplicate of the first question. I am able to ascertain that WITHOUT reference to the answer. What is 4 + 4? Well, that is the definition of 2 * 4, so this is a duplicate of the second question - again, NO reference to the answer.

Putting it another way: Two questions should be considered duplicates if it can be shown ahead of time, from basic principles, that they WILL have the same answer (that if one can be answered, then the other should be possible to answer similarly), even if no answer is known from the outset.

1
  • 11
    Relevant username.
    – BoltClock Mod
    Commented Jan 4, 2017 at 14:20
7

I posted a completely new answer tailored for the question by quoting and directly addressing the questions stated by the asker, and edited my :lang() answer to include a note on :dir().

I will not be marking the questions as duplicates, but if the community feels that they are duplicates their votes are theirs to use.

1
  • I think we're far too keen to mark questions as duplicates. In my 1 years experience using this site (in low-traffic tabs), the vast majority of questions marked as duplicates are no such thing.
    – Matthew
    Commented Jan 5, 2017 at 11:09
1

I think you fell into a common misconception with regards to duplicates. You state "there's a rule of thumb that says that if an answer to one question answers a different question exactly, word for word, then both questions are duplicates" which is not true. Just because one solution applies to another question does not mean that the questions are the same. That does not mean that is not the case here though, just that looking only at answers for duplicate eligibility is going to result in inappropriate closure from time to time.

The guidance for closing a duplication was said very well on the dupehammer post (emphasis mine):

Remember: duplicates are questions that ask for a solution to fundamentally identical problems - many questions have similar or identical answers but are not duplicates. By the same token, many questions are asked using very different wordings but seek to solve identical questions - closing these helps folks find their way to a solution even when they don't know what terms to search for.

These two questions pointed out do have fundamentally identical problems. Mostly that using the attribute selector will not match the inherited User Agent settings (or other Browser related settings) should they apply - which, you do address in your answer and that is the fundamental issue being presented in these two questions.

I believe they are duplicates, for the reasons explained above, and have voted as such.

9
  • 4
    I personally don't buy into the rule of thumb that I quote for the reasons you state, but you'll find a lot of folks on meta echoing that very guideline.
    – BoltClock Mod
    Commented Jan 4, 2017 at 2:50
  • 4
    @BoltClock - Just because a thousand people believe a foolish thing it doesn't make it any less foolish. That too is a quote, and a good one to boot. With that said, there are questions that are closed as duplicates when the linked question clearly does NOT answer the "duplicate" question, and it happens all the time. Let's not pretend that inappropriate closing happens only very rarely, and only due to fine distinctions in interpretation.
    – user5683823
    Commented Jan 4, 2017 at 14:49
  • Contrarily, I think it is true, depending on the subject matter of the question. In this case they are both CSS attribute questions, so the subject matter is as identical as it can get while talking about actually different words.
    – TylerH
    Commented Jan 4, 2017 at 17:45
  • 1
    @TylerH - Then you are doing it wrong.
    – Travis J
    Commented Jan 4, 2017 at 19:30
  • @TravisJ No, you are.
    – TylerH
    Commented Jan 4, 2017 at 19:33
  • @TylerH - You are faced with official outlook, yet you form your own opinion and take it as the law? Yes, you are quite the zealot. You are part of the problem that people call the "meta police" who are vigilante instead of community.
    – Travis J
    Commented Jan 4, 2017 at 19:35
  • @TravisJ Official outlook? The official outlook insofar as I'm aware (Shog, et al) is that my interpretation is correct: a question can be a duplicate of a different question if the answer is exactly the same. Anyway, my pithy response was not so much to argue with you as it was to show how pointless your "you're doing it wrong" comment was in the context of a discussion about practices.
    – TylerH
    Commented Jan 4, 2017 at 19:43
  • @TravisJ Also just a point of contention but if I were a part of a meta police then I-by definition-would not be a vigilante.
    – TylerH
    Commented Jan 4, 2017 at 19:44
  • Not worth wasting my time with this.
    – Travis J
    Commented Jan 4, 2017 at 19:50
1

In an ideal world, the older question wouldn't have been "What's the difference between html[lang="en"] and html:lang(en) in CSS?".

It should have been edited into something like "How to choose between using pseudo-classes and attribute selectors?" or something like that, anything that discusses the more generic case that applies to both situations discussed here and explains when to use one over the other, and potentially more.

In that case, if someone has the same question about yet another element/attribute combination, we can simply close that one as a duplicate of the generic canonical one. Unless of course a particular combination causes behavior that differs from the generic case, but then they can edit their question to show they understand what they are doing and that they have read and understood the canonical duplicate.

But we don't do that. We don't edit questions to apply to a broader audience, even though that doesn't alter the question at its core, nor its answers.

Instead it seems like we want to duplicate the entire question and all its answers, because a single keyword is different, even though the answers could be literal copies of each other, with only the keyword replaced. Because the keywords could have different intricacies.

But they don't, or at least they appear not to in this case. So the questions duplicate each other.

Both questions are exactly the same, the askers just happen to have chosen a different element/attribute combination to illustrate them.

The same happens with, for example, questions about reserved keywords, for example in SQL. "Why does SELECT TABLE FROM FOO not work?" is exactly the same question as "Why does SELECT COLUMN FROM FOO not work?".

By not closing questions like this as duplicates, we're duplicating identical information. This becomes troublesome in the long run, because it points later visitors (through web searches) to different interpretations of the specs, different styles of answering (the understanding kind, the spec-copy-pasting kind, the ever so unhelpful "try this" kind), and it makes maintenance harder, because if later on the specs change, and not all answers are updated to reflect the new truth.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .