>> document.getElementsByName('somename')[0] does not have the setAttribute
method so it wasn't working.
If that expression doesn't return null, it will have a setAttribute method.
However, `document.getElementsByName('foo')` is actually returning elements
that have an attribute with `name="foo"`; are you intending to use
`getElementsByTagName`? If you are actually using `getElementsByName` you
should probably just stop (our DOM engineer says it's "an abomination",
lol).
>> passing that vanilla element reference to jQuery and setting the
attributes there
Today, ShadowDOMPolyfill does not provide a patched version of
`getElementsByName`; if you really want to use it you have to `wrap` the
return value:
var element = wrap(document.getElementsByName('somename')[0]);
>> FWIW if you edit the attribute from the DOM Inspector it also doesn't
update Polymer!
On platforms using ShadowDOMPolyfill, you have to be careful what
techniques you use use to poke elements in the dev tools. If you stick to
'querySelector' you generally will be ok. If you describe exactly what you
are doing in the console (and in what browser) I can give you more
information.
Scott
On Wed, Jun 11, 2014 at 8:06 AM, <[email protected]> wrote:
> Hmm... so I've found a peculiar problem that caused this.
>
> document.getElementsByName('somename')[0] does not have the setAttribute
> method so it wasn't working.
>
> I was (for some reason that has since been rectified) passing that vanilla
> element reference to jQuery and setting the attributes there, which was
> updating the DOM when inspected, but was not triggering Polymer.
>
> FWIW if you edit the attribute from the DOM Inspector it also doesn't
> update Polymer!
>
> On Wednesday, 11 June 2014 14:08:22 UTC+1, Scott Miles wrote:
>
>> Seems to work in this jsbin (make sure you open the 'console' panel):
>> http://jsbin.com/gejeq/1/edit
>>
>> Does it work for you? If not, please describe the browser platform you
>> are testing on.
>>
>>
>> On Wed, Jun 11, 2014 at 5:47 AM, <[email protected]> wrote:
>>
>>> Hey all.
>>>
>>> I was wondering why changing an attribute doesnt seem to fire
>>> "attributeChanged". I made a fiddle here: http://jsfiddle.net/4awvr/
>>> and using the development tools to change the attribute "test" shows my
>>> issue.
>>>
>>> Thanks,
>>>
>>> Sam
>>>
>>> Follow Polymer on Google+: plus.google.com/107187849809354688692
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Polymer" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>>
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/polymer-dev/65a5af3c-7435-40db-887f-79bfff22658a%
>>> 40googlegroups.com
>>> <https://groups.google.com/d/msgid/polymer-dev/65a5af3c-7435-40db-887f-79bfff22658a%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> Follow Polymer on Google+: plus.google.com/107187849809354688692
> ---
> You received this message because you are subscribed to the Google Groups
> "Polymer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/polymer-dev/7ecfe94e-5b7c-4188-9b9a-971688340a2c%40googlegroups.com
> <https://groups.google.com/d/msgid/polymer-dev/7ecfe94e-5b7c-4188-9b9a-971688340a2c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/polymer-dev/CAHbmOLY-wfGZW1vwvi1X7nch_%3DdWRzR4M4Yzezr%3DpkojHYdU3w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.