Skip to main content

Bug Tracker

Side navigation

#13375 closed bug (notabug)

Opened February 03, 2013 11:12AM UTC

Closed February 03, 2013 02:09PM UTC

Last modified February 10, 2013 04:19AM UTC

"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.

Attachments (0)
Change History (11)

Changed February 03, 2013 02:09PM UTC by dmethvin comment:1

resolution: → notabug
status: newclosed

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

Changed February 07, 2013 08:22AM UTC by anonymous comment:2

jquery.js have this line inside!

Changed February 07, 2013 01:49PM UTC by dmethvin comment:3

Then please provide a test case that causes the problem.

Changed February 07, 2013 04:35PM UTC by anonymous comment:4

Changed February 07, 2013 05:26PM UTC by dmethvin comment:5

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

Changed February 08, 2013 07:15AM UTC by anonymous comment:6

Opera 10.10

Changed February 08, 2013 02:18PM UTC by dmethvin comment:7

Changed February 08, 2013 11:05PM UTC by miya2000 comment:8

  // 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.

Changed February 08, 2013 11:17PM UTC by miya2000 comment:9

Sorry. I made a mistake.

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

Changed February 09, 2013 07:06PM UTC by anonymous comment:10

Replying to [comment:7 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);
})();

Changed February 10, 2013 04:19AM UTC by miya2000 comment:11

Replying to [comment:7 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.