Last Comment Bug 844134 - attributes should be defined on Element and not Node
: attributes should be defined on Element and not Node
Status: RESOLVED FIXED
: addon-compat, dev-doc-complete, site-compat
Product: Core
Classification: Components
Component: DOM (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla22
Assigned To: :Ms2ger
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-02-22 08:10 PST by Erik Arvidsson
Modified: 2014-09-07 23:21 PDT (History)
8 users (show)
Ms2ger: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch v1 (21.47 KB, patch)
2013-03-10 13:21 PDT, :Ms2ger
jonas: review+
Details | Diff | Review

Description Erik Arvidsson 2013-02-22 08:10:24 PST
It makes no sense to expose attributes and hasAttributes on non Elements and DOM core updated the spec accordingly.
Comment 1 :Ms2ger 2013-02-25 04:21:09 PST
I've got a patch for attributes.
Comment 2 :Ms2ger 2013-03-10 13:21:45 PDT
Created attachment 723255 [details] [diff] [review]
Patch v1

I filed bug 849661 for hasAttributes.
Comment 3 Jonas Sicking (:sicking) 2013-03-10 23:05:03 PDT
Comment on attachment 723255 [details] [diff] [review]
Patch v1

Review of attachment 723255 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with the below fixed.

::: layout/inspector/src/inDOMView.cpp
@@ +1178,5 @@
>  {
>    NS_ENSURE_ARG(aNode);
>    // attribute nodes
>    if (mWhatToShow & nsIDOMNodeFilter::SHOW_ATTRIBUTE) {
> +    if (nsCOMPtr<nsIDOMElement> element = do_QueryInterface(aNode)) {

Are you sure this will work? The assignment operator for do_QI works weirdly in that do_QI doesn't actually return the result of the QI, it always returns a non-null object.

I'd move this outside out the if-statement and just do |if (element)| to be on the safe side. It's not causing any runtime or compile time cost.
Comment 5 Kohei Yoshino [:kohei] 2013-03-29 09:56:20 PDT
I've added this bug to the compatibility doc. Please correct the info if wrong.
https://developer.mozilla.org/en-US/docs/Site_Compatibility_for_Firefox_22

Also, please update the following doc:
https://developer.mozilla.org/en-US/docs/DOM/Node.attributes

Note You need to log in before you can comment on or make changes to this bug.