Implement HTML5's <mark> tag

RESOLVED FIXED in mozilla2.0b1

Status

()

Core
DOM
--
enhancement
RESOLVED FIXED
9 years ago
3 years ago

People

(Reporter: Ivan Enderlin, Assigned: Ms2ger)

Tracking

(Blocks: 1 bug, {dev-doc-complete, html5})

Trunk
mozilla2.0b1
dev-doc-complete, html5
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(2 attachments, 4 obsolete attachments)

(Reporter)

Description

9 years ago
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
(Reporter)

Comment 1

9 years ago
Created attachment 369531 [details] [diff] [review]
patch 0.1: early draft
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?
(Reporter)

Comment 4

9 years ago
@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.
(Reporter)

Comment 6

9 years ago
Definitively. I am currently working on this feature.

Comment 7

8 years ago
(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
(Assignee)

Updated

7 years ago
Keywords: html5
Version: unspecified → Trunk

Comment 9

7 years ago
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

Comment 11

7 years ago
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.

Comment 12

7 years ago
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.
(Reporter)

Comment 13

7 years ago
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).
(Assignee)

Comment 14

7 years ago
Created attachment 446980 [details] [diff] [review]
Patch v2

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)
Comment on attachment 446980 [details] [diff] [review]
Patch v2

Thanks!
Attachment #446980 - Flags: review?(jonas) → review+
(Assignee)

Comment 16

7 years ago
Created attachment 447511 [details] [diff] [review]
Editor patch v1

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)

Comment 17

7 years ago
i have a feeling this is going to conflict with bug 562008.
(Reporter)

Comment 18

7 years ago
@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.
(Reporter)

Comment 20

7 years ago
@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
(Assignee)

Comment 22

7 years ago
Created attachment 449613 [details] [diff] [review]
Content patch v2 (merged to tip)

Merged to tip. r=jonas
Attachment #446980 - Attachment is obsolete: true
Blocks: 573357
(Assignee)

Updated

7 years ago
Depends on: 573377
(Assignee)

Comment 23

7 years ago
Created attachment 452587 [details] [diff] [review]
Editor patch v2

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)

Updated

7 years ago
Attachment #452587 - Flags: review?(timeless) → review+
(Assignee)

Comment 24

7 years ago
Created attachment 452701 [details] [diff] [review]
Patch for checkin

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
(Assignee)

Updated

7 years ago
Keywords: checkin-needed

Updated

7 years ago
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
Last Resolved: 7 years ago
Keywords: checkin-needed → dev-doc-needed
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.
Keywords: dev-doc-needed → dev-doc-complete
(Assignee)

Updated

7 years ago
Flags: in-testsuite+

Updated

5 years ago
Blocks: 568516
You need to log in before you can comment on or make changes to this bug.