Closed Bug 485377 Opened 14 years ago Closed 12 years ago

Implement HTML5's <mark> tag

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla2.0b1

People

(Reporter: ivan.enderlin, Assigned: Ms2ger)

References

(Blocks 1 open bug, )

Details

(Keywords: dev-doc-complete, html5)

Attachments

(2 files, 4 obsolete files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008101315 Ubuntu/8.10 (intrepid) Firefox/3.0.3
Build Identifier: 

The HTML 5 draft recommendation describes the <mark> element as follow:
"The <mark> element represents a run of text in one document marked or
highlighted for reference purposes, due to its relevance in another context.
When used in a quotation or other block of text referred to from the prose, it
indicates a highlight that was not originally present but which has been added
to bring the reader's attention to a part of the text that might not have been
considered important by the original author when the block was originally
written, but which is now under previously unexpected scrutiny. When used in the
main prose of a document, it indicates a part of the document that has been
highlighted due to its likely relevance to the user's current activity.".

More examples at
<http://www.whatwg.org/specs/web-apps/current-work/#the-mark-element>

The draft does not precise a default style.

It is a semantic element, with generic HTML properties.

Reproducible: Always
You shouldn't need the new nsHTMLMarkElement.cpp, and indeed it doesn't seem like you're actually using it. The change to nsHTMLTagList.h ensures that we instantiate an nsHTMLSpanElement, which seems to be exactly what we want.
Does the <mark> element need un-<span>-like exposure to accessibility APIs?
@Jonas: Yes, the nsHTMLTagList declaration asserts to use the nsHTMLSpanElement. Should it be suffisant to do that ? I have note that also the <abbr> element is recognized like a <span> (test: http://mozilla.hoa-project.net/Test/Abbr.html).

@Henri: I think no. I have looked for in the HTML 5 specification and I didn't find anything that is on the subject, but I may be wrong :-).
Perhaps the "Find Again" command should cycle through <mark> elements when the user hasn't entered a search string into the "Find" bar.
Definitively. I am currently working on this feature.
(In reply to comment #0)
> The draft does not precise a default style.

Actually, it does.

http://www.w3.org/TR/html5/the-xhtml-syntax.html#the-css-user-agent-style-sheet-and-presentational-hints
Not a parser bug, AFAICT.
Status: UNCONFIRMED → NEW
Component: HTML: Parser → DOM
Ever confirmed: true
QA Contact: parser → general
Keywords: html5
Version: unspecified → Trunk
Would a patch for adding "mark { background: yellow; color: black; }" to html.css be better than not having any support at all, where the alternative is to implement everything (is there anything other than CSS and DOM changes to be done?) related to the "mark" element at a later date?

It could be noted that similar actions has already been taken for several other HTML5 elements, in bug 559284.
Why go for a half-assed implementation. There is a patch that is almost finished. Why not finish and land that instead.

Just remove the changes to nsGenericHTMLElement.h and remove the new nsHTMLMarkElement.* files. And add the html.css change in comment 9.

Then add a reftest checking that the default rendering is ok and that |document.createElement("mark") instanceof HTMLElement| is true
and
|document.createElement("mark") instanceof HTMLUnknownElement| is false
Well, considering the patch is called "Patch 0.1: Early draft" and haven't been updated since early 2009, I assumed it was pretty "dead" and perhaps out of date. Still, the full implementation is of course what we want to do/have.
Oh, and to avoid misunderstandings, this is not me taking on the task to update the patch. If it was as easy as just uploading a new version of the file, I probably could, but those patch/building instructions look too advanced for me, and I don't have the time to learn how to do it properly right now.
The patch is not dead. I'm just waiting 2 days free to work on this patch…

If it is too easy as Jonas said, I can make it in June maybe (I hope).
Attached patch Patch v2 (obsolete) — Splinter Review
Updated to Jonas' comments. Ivan, I hope you don't mind.

Note that |document.createElement("mark") instanceof HTMLUnknownElement| isn't false. Apparently, all HTML elements implement HTMLUnknownElement.
Attachment #446980 - Flags: review?(jonas)
Attached patch Editor patch v1 (obsolete) — Splinter Review
Turns out I needed to tell editor about it too... This change is covered by the following existing tests

docshell/test/navigation/test_bug386782.html
editor/composer/test/test_bug384147.html
editor/libeditor/html/tests/browserscope/test_browserscope.html
editor/libeditor/html/tests/test_bug478725.html
editor/libeditor/html/tests/test_bug487524.html
layout/generic/test/test_backspace_delete.xul
Attachment #447511 - Flags: review?(timeless)
i have a feeling this is going to conflict with bug 562008.
@Ms2ger It's ok, I don't mind :-). I prefere to see this patch going further instead of resting in peace ;-).
hmm, Ms2ger, your patch makes <mark> be an HTMLSpanElement. I don't think we want <mark> to be an HTMLSpanElement (even if that makes <mark> using HTMLElement interface) ?

IOW, document.createElement('mark').constructor should return HTMLElement, not HTMLSpanElement.
@Mounir: That's what I thought at the begining, but in Gecko, the majority of semantic elements are reconized as HTMLSpanElement.
(In reply to comment #20)
> @Mounir: That's what I thought at the begining, but in Gecko, the majority of
> semantic elements are reconized as HTMLSpanElement.

Indeed. Anyway, this is going to be fixed with bug 562008.
@Ms2ger: could you open a follow-up depending on bug 562008 and put me in CC ?
Blocks: 568509
Attached patch Content patch v2 (merged to tip) (obsolete) — Splinter Review
Merged to tip. r=jonas
Attachment #446980 - Attachment is obsolete: true
Blocks: 573357
Depends on: 573377
Attached patch Editor patch v2 (obsolete) — Splinter Review
timeless, could you review this patch as well? Thanks!
Attachment #447511 - Attachment is obsolete: true
Attachment #452587 - Flags: review?(timeless)
Attachment #447511 - Flags: review?(timeless)
Attachment #452587 - Flags: review?(timeless) → review+
This patch contains attachment 449613 [details] [diff] [review] (r=jonas) and attachment 452587 [details] [diff] [review] (r=timeless), as well as attachment 447778 [details] [diff] [review] from bug 568509 (r=jonas).
Attachment #449613 - Attachment is obsolete: true
Attachment #452587 - Attachment is obsolete: true
Keywords: checkin-needed
Assignee: nobody → Ms2ger
Status: NEW → ASSIGNED
Assuming this needs to be documented, so adding dev-doc-needed.

http://hg.mozilla.org/mozilla-central/rev/b4149e2c4056
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a6
Documented as: https://developer.mozilla.org/en/HTML/Element/mark
(I'll update it once bug 568509 land).

As I cannot change the keyword dev-doc-needed to dev-doc-complete, if somebody could do it, it would be nice.
Flags: in-testsuite+
Blocks: html
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.