Last Comment Bug 649599 - Make getAttributeNS return null for absent attributes
: Make getAttributeNS return null for absent attributes
Status: RESOLVED FIXED
[wdc]
: dev-doc-complete
Product: Core
Classification: Components
Component: DOM: Core & HTML (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla13
Assigned To: :Ms2ger (⌚ UTC+1/+2)
:
Mentors:
http://dvcs.w3.org/hg/domcore/raw-fil...
: 382786 (view as bug list)
Depends on: 767353
Blocks:
  Show dependency treegraph
 
Reported: 2011-04-13 02:33 PDT by :Ms2ger (⌚ UTC+1/+2)
Modified: 2012-06-22 06:39 PDT (History)
4 users (show)
Ms2ger: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch v1 (2.03 KB, patch)
2011-04-13 02:33 PDT, :Ms2ger (⌚ UTC+1/+2)
peterv: review+
Details | Diff | Splinter Review
Patch v2 (2.74 KB, patch)
2012-01-08 05:58 PST, :Ms2ger (⌚ UTC+1/+2)
Ms2ger: review-
Details | Diff | Splinter Review

Description :Ms2ger (⌚ UTC+1/+2) 2011-04-13 02:33:50 PDT
Created attachment 525645 [details] [diff] [review]
Patch v1
Comment 1 Boris Zbarsky [:bz] 2011-04-13 07:14:25 PDT
Is this web-compatible?  I thought browsers had converged on getAttribute and getAttributeNS returning "" and the DOM spec just hadn't been errata'd accordingly (and that Web DOM Core was going to make that change).
Comment 2 :Ms2ger (⌚ UTC+1/+2) 2011-04-13 07:55:03 PDT
Almost. Browsers have converged on getAttribute returning null, while DOM specs required the empty string. (<http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-666EE0F9>.) IIRC, there was no consensus either way for getAttributeNS, but it seems to make more sense to have them consistent.
Comment 3 Boris Zbarsky [:bz] 2011-04-14 12:28:04 PDT
Oh, ok.  so I just had it backwards.  Gotcha.
Comment 4 :Ms2ger (⌚ UTC+1/+2) 2011-06-13 12:47:51 PDT
*** Bug 382786 has been marked as a duplicate of this bug. ***
Comment 5 Peter Van der Beken [:peterv] 2011-10-17 06:54:58 PDT
Comment on attachment 525645 [details] [diff] [review]
Patch v1

How woudl you feel about doing this in GetAttr instead? There shouldn't be too many implementations of that.
Comment 6 :Ms2ger (⌚ UTC+1/+2) 2011-10-18 10:53:24 PDT
That works for me. (I understood void strings to be frowned upon except for passing to JS directly, though.)
Comment 7 :Ms2ger (⌚ UTC+1/+2) 2012-01-08 05:58:02 PST
Created attachment 586800 [details] [diff] [review]
Patch v2
Comment 8 :Ms2ger (⌚ UTC+1/+2) 2012-01-10 01:18:42 PST
Comment on attachment 586800 [details] [diff] [review]
Patch v2

Yeah, no. This makes reflected attributes return null, and that breaks the web.
Comment 9 :Ms2ger (⌚ UTC+1/+2) 2012-03-11 03:17:38 PDT
https://hg.mozilla.org/mozilla-central/rev/1eab6ae9e060
Comment 10 Eric Shepherd [:sheppy] 2012-04-29 10:56:32 PDT
Docs updated:

https://developer.mozilla.org/en/DOM/element.getAttributeNS

Mentioned on Firefox 13 for developers.

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