Open Bug 1055465 Opened 10 years ago Updated 2 years ago

No need for removeAttributeNode return value to to be nullable

Categories

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

x86
macOS
defect

Tracking

()

People

(Reporter: annevk, Unassigned)

Details

Found this while trying to write the specification for this method. It either throws or returns the attribute it just removed. There's no other state.
Assignee: nobody → wknapek
Hello Anne what should this method return and when ?
It should return the same type, just not nullable (indicated by the ? after the type): http://mxr.mozilla.org/mozilla-central/source/dom/webidl/Element.webidl#149
OK do if i think correctly method return attribute just removed or nullptr. In correct state it should always return attribute?  Somebody correct me if I'm wrong
bur what if removal fails?
The understanding is that the method will either return a non-null value or it will throw an error. In that case it will return a null value, but for the purposes of the API described in the WebIDL file, that return value is never seen by callers so it doesn't matter.
Attr? removeAttributeNode(Attr oldAttr); so i must delete "?" like this -> Attr removeAttributeNode(Attr oldAttr); in ../source/dom/webidl/Element.webidl file ?
Yes, and verify that the method is in fact throwing any time it returns null.
This method is removed from DOM4 spec.
Please have a look. I have read about it. Here, http://www.w3.org/TR/dom/#element
That's an old draft from July 2014.  Before people realized it couldn't be removed because it's being used.  A good rule of thumb is that by the time a draft ends up under TR/ it's out of date.

The link in comment 9 is the current draft of the spec.
Component: DOM → DOM: Core & HTML

The bug assignee didn't login in Bugzilla in the last 7 months, so the assignee is being reset.

Assignee: wknapek → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.