Getting the `value` attribute of a `<data>` element returned undefined #40

wants to merge 3 commits into

3 participants


No description provided.

ded commented Nov 2, 2011

this more than likely happens on all HTML5 elements.. :/


The spec allow the value attribute only on <li> in <ol>s and <data>.
I have fix my problem on the <data> by doing this because bonzo doesn't check the case sensitivity on specialAttributes : $('data').attr('Value')


@Calvein can you write a test or two for it? Just fiddling in Chrome I can see that (<data>).value gives undefined while (<data>).getAttribute('value') gives the attribute value which is where attr() is tripping up for you but <li> seems to work OK wtih just .value (or ['value']). Would be good to see it across browsers.
Would also be good to fix the case sensitivity thing too, perhaps a toLowerCase() rather than fixing the regex cause I think the spec wants lower case attribute keys anyway?


In IE8 li.value or li['value'] returns a boolean not the correct value.
For the case sensitivity issue, we may just add an i at the end of the specialAttributes variable: /^checked|value|selected$/i

I'll do the test later :)


hey there @Calvein — i'm going through some old requests, if you'd like this one in, would you mind isolating your edits to src/bonzo.js and of course, keep your added tests? as it stands it conflicts with master. cc @rvagg


I think it would be better to wait for the <data> element to be in the spec ( and not only in the whatwg (, I'm not sure if it will stay because of the come back of the <time> element.

@ded ded closed this Feb 22, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment