resolution: |
→ invalid
|
status: |
new → closed
|
Thanks for taking the time to contribute to the jQuery project by writing a bug report!
After checking what you reported I conclude that this isn't a jQuery bug. What you are doing is also very uncommon and the correct jQuery way to do this would be to use $(selector).bind("click", somefunction)
(as this is guaranteed to work cross-browser).
But it probably also isn't a bug in Chrome.
I made this test case during checking on your problem. As you can see all buttons but "Click me 4" work in Chrome.
To understand this you need to know that attr(name, value)
doesn't set the HTML attribute but uses the DOM property and it looks like Chrome (rightfully) doesn't allow setting the onclick DOM property to a string but only to a function. Other browsers are less strict about this and automagically convert a string assignment into a function. Chrome doesn't.
attr(name, value)
using the DOM property also explains why "Click me 7" works but "Click me 4" doesn't, as for "Click me 7" I set the HTML attribute directly and in this case (as when done inline) Chrome converts the value to a function call.
So basically you have just hit a "rough" (or better differing) point in Chrome's DOM implementation. If you understood all of the above and still feel this is a bug then feel free to report this on the Chrome bug tracker.
Thanks for taking the time to contribute to the jQuery project by writing a bug report!
After checking what you reported I conclude that this isn't a jQuery bug. What you are doing is also very uncommon and the correct jQuery way to do this would be to use
$(selector).bind("click", somefunction)
(as this is guaranteed to work cross-browser).But it probably also isn't a bug in Chrome.
I made this test case during checking on your problem. As you can see all buttons but "Click me 4" work in Chrome.
To understand this you need to know that
attr(name, value)
doesn't set the HTML attribute but uses the DOM property and it looks like Chrome (rightfully) doesn't allow setting the onclick DOM property to a string but only to a function. Other browsers are less strict about this and automagically convert a string assignment into a function. Chrome doesn't.attr(name, value)
using the DOM property also explains why "Click me 7" works but "Click me 4" doesn't, as for "Click me 7" I set the HTML attribute directly and in this case (as when done inline) Chrome converts the value to a function call.So basically you have just hit a "rough" (or better differing) point in Chrome's DOM implementation. If you understood all of the above and still feel this is a bug then feel free to report this on the Chrome bug tracker.