Closed
Bug 968637
Opened 10 years ago
Closed 9 years ago
add the DOMTokenList relList to HTMLLinkElement, HTMLAreaElement and HTMLAnchorElement
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla30
People
(Reporter: karlcow, Assigned: agi)
Details
(Keywords: dev-doc-complete, Whiteboard: [mentor=bz][lang=c++])
Attachments
(1 file, 2 obsolete files)
A "rel" attribute in a "link", "area" or a "a" element may contain a list of space separated values. Example: <link rel="shortcut icon" …> or <a href="…" rel="archive month">…</a> The interface HTMLLinkElement : HTMLElement {…} contains readonly attribute DOMTokenList relList; See http://www.w3.org/html/wg/drafts/html/master/document-metadata.html#dom-link-rellist and interface HTMLAnchorElement : HTMLElement {…} contains readonly attribute DOMTokenList relList; }; See http://www.w3.org/html/wg/drafts/html/master/text-level-semantics.html#htmlanchorelement and interface HTMLAreaElement : HTMLElement {…} contains readonly attribute DOMTokenList relList; }; See http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#htmlareaelement As of Firefox 27, the method is currently not implemented both for "link", "area" and "a".
![]() |
Reporter | |
Comment 1•10 years ago
|
||
Maybe a test. <!doctype html> <html> <title>test link</title> <link rel="shortcut icon" href="/favicon.ico"> <script> var linkrellist = document.querySelectorAll('link[rel]'); var link = linkrellist[0]; if (link[0].relList.indexOf('shortcut') && link[0].relList.indexOf('icon')) { console.log('pass') } else { console.log('fail')} </script> </html>
![]() |
Reporter | |
Comment 2•10 years ago
|
||
s/link[0]/link/
![]() |
Reporter | |
Updated•10 years ago
|
Summary: add the DOMTokenList relList to HTMLLinkElement → add the DOMTokenList relList to HTMLLinkElement, HTMLAreaElement and HTMLAnchorElement
![]() |
||
Updated•10 years ago
|
Whiteboard: [mentor=bz][lang=c++]
Comment 3•10 years ago
|
||
I would like to work on this. Could you please give me a little guide about this bug?
![]() |
||
Comment 4•10 years ago
|
||
The simplest thing to do is probably to just add a new member to the relevant classes to store the list, uncomment the relevant lines in the WebIDL, and implement the getter. The getter will end up doing what Element::GetClassList does, except with a different attr name and storing the value in the element directly, not in the slots.
Comment 5•9 years ago
|
||
Could you please be a little more specific? Which part of code should I read? Thank you.
![]() |
||
Comment 6•9 years ago
|
||
Element::GetClassList can be found via http://dxr.mozilla.org/mozilla-central/search?q=Element%3A%3AGetClassList&redirect=true and is at http://dxr.mozilla.org/mozilla-central/source/content/base/src/Element.cpp#435 The other relevant files are dom/webidl/HTMLLinkElement.webidl, dom/webidl/HTMLAreaElement.webidl, dom/webidl/HTMLAnchorElement.webidl, and content/html/content/src/HTMLLinkElement.{h,cpp} and so forth.
Assignee | ||
Comment 7•9 years ago
|
||
I cooked up a patch for HTMLLinkElement and HTMLAnchorElement, for HTMLAreaElement it seems that even "rel" is not implemented, so I figure we should do that first. About the test, I think it should be if (link.relList.contains('shortcut') && link.relList.contains('icon')) { instead of if (link[0].relList.indexOf('shortcut') && link[0].relList.indexOf('icon')) { Can I have this bug assigned so I can finish it? Thank you!
Attachment #8384292 -
Flags: review?(bzbarsky)
Assignee | ||
Updated•9 years ago
|
Attachment #8384292 -
Attachment is obsolete: true
Attachment #8384292 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 8•9 years ago
|
||
I'm sorry I'm still trying to figure out how mercurial works. This new version of the patch has a description and adds rel and relList to HTMLAreaElement as well. Please let me know if I have to modify something else, I tried searching through the code but I'm very new here. Thanks.
Attachment #8384392 -
Flags: review?(bzbarsky)
![]() |
||
Updated•9 years ago
|
Assignee: nobody → agi.novanta
![]() |
||
Comment 9•9 years ago
|
||
Comment on attachment 8384392 [details] [diff] [review] Added "rel" to HTMLAreaElement and "relList" to HTMLAreaElement, HTMLLinkElement and HTMLAnchorElement >+nsRefPtr<nsDOMTokenList > This return type (unlike the type of the member) should just be nsDOMTokenList*. >+HTMLAnchorElement::RelList() { Linebreak before the '{', please. >+++ b/content/html/content/src/HTMLAnchorElement.h Please don't make stray whitespace changes (e.g. removing blank lines) here. You need to add this new member to cycle collection. Just NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mRelList) in the NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED bit and NS_IMPL_CYCLE_COLLECTION_UNLINK(mRelList) in the NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED bit should do the trick. Similar issues for the other files. r=me with those nits fixed, and thank you!
Attachment #8384392 -
Flags: review?(bzbarsky) → review+
![]() |
||
Comment 10•9 years ago
|
||
Giovanni, you plan to update the patch, right?
Flags: needinfo?(agi.novanta)
Assignee | ||
Comment 11•9 years ago
|
||
Yes. I just have to review everything. I'll submit the patch Friday or Saturday. Thank you.
Flags: needinfo?(agi.novanta)
Assignee | ||
Comment 12•9 years ago
|
||
Ok, I think I fixed everything. Please let me know if there's something wrong. Thank you!
Attachment #8384392 -
Attachment is obsolete: true
Attachment #8388085 -
Flags: review?(bzbarsky)
Updated•9 years ago
|
Keywords: dev-doc-needed
![]() |
||
Comment 13•9 years ago
|
||
Comment on attachment 8388085 [details] [diff] [review] Added "rel" and "relList" to HTMLAreaElement and "relList" to HTMLLinkElement, HTMLAnchorElement; r=bz r=me
Attachment #8388085 -
Flags: review?(bzbarsky) → review+
![]() |
||
Updated•9 years ago
|
Keywords: checkin-needed
Comment 14•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/64d45543afe4
Keywords: checkin-needed
Comment 15•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/64d45543afe4
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
Comment 16•9 years ago
|
||
Doc updated: https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement.rel https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement.relList https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement.rel https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement.relList https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement.rel https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement.relList and https://developer.mozilla.org/en-US/Firefox/Releases/30
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•