#13375 closed bug (notabug)
"div.cloneNode( true ).click();" don't works in Opera
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.9.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I made simple jqtest.html: "<script src="http://code.jquery.com/jquery.js"></script>", open it in browser and get error:
JavaScript - file://localhost/D:/jqtest.html Inline script thread Error: name: TypeError message: Statement on line 1415: Type mismatch (usually non-object value supplied where object required) stacktrace: Line 1415 of linked script http://code.jquery.com/jquery.js
div.cloneNode( true ).click();
Line 1286 of linked script http://code.jquery.com/jquery.js
jQuery.support = (function() {
Line 14 of linked script http://code.jquery.com/jquery.js
(function( window, undefined ) {
After commenting line "div.cloneNode( true ).click();" i get no error.
Change History (11)
comment:1 Changed 10 years ago by
Resolution: | → notabug |
---|---|
Status: | new → closed |
comment:5 Changed 10 years ago by
Sorry but I don't see that error. Opera 12.14, Windows. Please try to triage this on the forum or StackOverflow.
comment:7 follow-ups: 10 11 Changed 10 years ago by
Don't support that. http://jquery.com/browser-support/
comment:8 Changed 10 years ago by
// Opera does not clone events (and typeof div.attachEvent === undefined).
Opera10.10 does not clone events (and typeof div.attachEvent === undefined and typeof div.click === undefined).
(BTW, a.click and input.click is Function. :P)
I hope this small matter will be fixed. I love Opera10.10.
comment:9 Changed 10 years ago by
Sorry. I made a mistake.
Opera10.10 does not clone events (and typeof div.attachEvent !== undefined and typeof div.click === undefined).
comment:10 Changed 10 years ago by
Replying to dmethvin:
Don't support that. http://jquery.com/browser-support/
Modern Opera is piece of shit :-(
Crutch for 10.10 and jQuery:
(function(){ var opera = window.opera; opera.addEventListener('BeforeScript',function (e) { if (e.element.src.indexOf('jquery')!=-1){ opera.postError('Crutch for jQuery') e.element.text = e.element.text.replace(/\sdiv\.cloneNode\(\s*true\s*\)\.click\(\);/,' ').replace(/,d\.cloneNode\(!0\)\.click\(\)/,''); } },false); })();
comment:11 Changed 10 years ago by
Replying to dmethvin:
Don't support that. http://jquery.com/browser-support/
Please revert to before https://github.com/jquery/jquery/commit/c8c6ab6924b48832bfc2b94d40887b2f1b6c891e
if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
div.cloneNode( true ).fireEvent("onclick");
Using "fireEvent" is strictly correct answer in my opinion.
jQuery doesn't have a
.cloneNode()
method. Please read the docs and/or ask for help on a forum.