Bug Tracker

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#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 6 years ago by dmethvin

Resolution: notabug
Status: newclosed

jQuery doesn't have a .cloneNode() method. Please read the docs and/or ask for help on a forum.

comment:2 Changed 6 years ago by anonymous

jquery.js have this line inside!

comment:3 Changed 6 years ago by dmethvin

Then please provide a test case that causes the problem.

comment:5 Changed 6 years ago by dmethvin

Sorry but I don't see that error. Opera 12.14, Windows. Please try to triage this on the forum or StackOverflow.

comment:6 Changed 6 years ago by anonymous

Opera 10.10

comment:7 Changed 6 years ago by dmethvin

comment:8 Changed 6 years ago by miya2000

  // 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 6 years ago by miya2000

Sorry. I made a mistake.

Opera10.10 does not clone events (and typeof div.attachEvent !== undefined and typeof div.click === undefined).

comment:10 in reply to:  7 Changed 6 years ago by anonymous

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 in reply to:  7 Changed 6 years ago by miya2000

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.

Note: See TracTickets for help on using tickets.