Open Bug 1221255 Opened 5 years ago Updated 2 years ago

Make Attr.nodeValue and Attr.textContent directly alias for Attr.value


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

40 Branch
Not set





(Reporter: crimsteam, Unassigned)


User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0
Build ID: 20151029151421

Steps to reproduce:

Per DOM spec Attr.nodeValue and Attr.textContent should be defined directly in Attr interface and be an alias for  Attr.value:
They were added because usage frome Chrome status is hight:

I see that Chrome 46 (stable) make this change so probably Firefox can safely follow with them.

Btw, Attr.value doesn't have any special requirements for null value, so Attr.nodeValue and Attr.textContent (as alias) should behave similarly (oposite to Node.nodeValue and Node.textContet). Chrome in this case has probably small bug.

Small testcase:

	var el = document.createElement("div"); = "test";
	var firstAttr = el.attributes[0];

	console.log(Attr.prototype.hasOwnProperty("textContent")); // should be true
	console.log(firstAttr.__proto__.hasOwnProperty("textContent")); // should be true

	firstAttr.textContent = null;
	console.log(firstAttr.textContent); // should be "null"

Component: General → DOM
Now I see that some times ago Attr.nodeValue and Attr.textContent got [TreatNullAs=EmptyString], so Chrome is correct here, sorry for the confusion.
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.