Opened 9 years ago

Closed 4 years ago

#11274 closed defect (worksforme)

Impossible to set "value" attribute of <meter> tags via dojo/attr

Reported by: Thomas Bachem Owned by: Kris Zyp
Priority: high Milestone: 1.11
Component: HTML Version: 1.4.3
Keywords: Cc:
Blocked By: Blocking:

Description

We're using HTML5 <meter> tags in our markup, which have a valid attribute called "value".

dojo.attr() however forces using the property instead of attribute when it comes to "value" (see var _forcePropNames), which does not work in that case and makes changing the "value" attribute impossible.

This should at least be noted in the documentation but even better get fixed in dojo.attr().

So long we're directly using setAttribute() for this case.

Change History (10)

comment:1 Changed 9 years ago by James Burke

Milestone: tbd1.6
Owner: changed from sjmiles to Eugene Lazutkin

Too late to get this into 1.5, marking for 1.6. If elazutkin thinks it is an easy fix that does not require testing, we can move it back.

comment:2 Changed 9 years ago by bill

Milestone: 1.6future

(sadly) punting seemingly abandoned ticket and meta tickets to future

comment:3 Changed 6 years ago by dylan

Milestone: future1.10
Owner: changed from Eugene Lazutkin to kriszyp
Status: newassigned
Summary: Impossible to set "value" attribute of <meter> tags via dojo.attr()Impossible to set "value" attribute of <meter> tags via dojo/attr

Improve HTML5 support for Dojo 1.10

comment:4 Changed 5 years ago by dylan

Owner: changed from kriszyp to Kris Zyp

comment:5 Changed 5 years ago by dylan

Milestone: 1.101.11

I really wanted to get this in for 1.10, but we're simply out of time and want to get the release done. Given that the workaround is to use setAttribute, and there's no patch, I'm pushing this to 1.11.

comment:6 Changed 5 years ago by ido

I did a test on chrome, firefox, ie8, ie10 and it seems ok...

https://github.com/dojo/dojo/pull/100

comment:7 Changed 4 years ago by dylan

The test for this appears to have been lost in the conversion. That said, the test showed that this worked as expected, so maybe we don't need it?

comment:8 Changed 4 years ago by bill

Yes, dojo.attr() is working as expected, namely that it sets the property rather than the attribute for certain exceptional cases:

var forcePropNames = {
	innerHTML:	1,
	textContent:1,
	className:	1,
	htmlFor:	has("ie"),
	value:		1
},

This conflating of properties and attributes is a design decision we regret, but too late to change it in 1.x. FWIW jQuery had the same issue.

I agree both the API and reference documentation is lacking. So you could either close this ticket as working as expected, or update the API and reference doc.

PS: the test is https://github.com/dojo/dojo/commit/2d2e981b5129c6dbca28bc18895a72c3e9305d3a.

comment:9 Changed 4 years ago by dylan

Right, my point on the tests was that the test in that commit did not make it into the Intern conversion as far as I can tell ( https://github.com/dojo/dojo/blob/master/tests/unit/dom-attr.js ). I mean, it's probably covered in those tests, just no explicit test on a more recent html tag addition such as <meter>

comment:10 Changed 4 years ago by dylan

Resolution: worksforme
Status: assignedclosed
Note: See TracTickets for help on using tickets.