Opened 9 years ago
Closed 9 years ago
#15208 closed bug (duplicate)
jQuery.extend
Reported by: | Michael | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | core | Version: | |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
File: index.hmtl
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Test for jQuery.extend</title> </head> <body> <script src="MyLibrary.js" type="text/javascript"></script> <script src="//cdn.jsdelivr.net/jquery/1.11.1/jquery.min.js" type="text/javascript"></script> </body> </html>
File: MyLibrary.js
(function (document) { // region To Debug function debug(text, args) { for (var buffer = [], count = args.length, index = 0; index < count; ) buffer.push(args[index++]); if (count) text += '\n' + buffer.join('\n'); document.body.appendChild(document.createElement('pre')).innerHTML = text } // endregion // region MyLibrary extensions // Static extension: Object.extend(target: Object, source: Object, ...): Object Object.extend = function () { debug('Object.extend is called', arguments) }; // Instance extension: ({ ... }).extend(source: Object, ...): Object Object.prototype.extend = function () { debug('Object.prototype.extend is called', arguments) }; // endregion })(document);
Change History (7)
comment:1 follow-up: 2 Changed 9 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 Changed 9 years ago by
Replying to rwaldron:
It's an excuse only. See code below.
File: index.hmtl (modified)
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Test for jQuery.extend</title> </head> <body> <script src="MyLibrary.js" type="text/javascript"></script> <script src="MyLibraryPlus.js" type="text/javascript"></script> <script src="MyLibraryTest.js" type="text/javascript"></script> <script src="//cdn.jsdelivr.net/jquery/1.11.1/jquery.min.js" type="text/javascript"></script> </body> </html>
File: MyLibraryPlus.js (extend overloading)
(function (document) { // region To Debug function debug(text) { document.body.appendChild(document.createElement('pre')).innerHTML = text } // endregion var MyQuery = (window || this).MyQuery = function () { }; MyQuery.extend = function () { debug('static MyQuery.extend is called') }; MyQuery.prototype.extend = function () { debug('instance MyQuery.extend is called') }; })(document);
File: MyLibraryTest.js (tests for extend)
(function () { MyQuery.extend(); new MyQuery().extend(); })();
comment:3 follow-up: 4 Changed 9 years ago by
It's unclear what bug you're trying to report. Please follow the instructions displayed on the bug filing page and provide a fiddle http://jsfiddle.net/ that demonstrates the most reduced case. Additional explanation helps as well.
comment:4 Changed 9 years ago by
Replying to rwaldron:
It's unclear what bug you're trying to report. Please follow the instructions displayed on the bug filing page and provide a fiddle http://jsfiddle.net/ that demonstrates the most reduced case. Additional explanation helps as well.
Ok, see this demo at jsFiddle: jsFiddle.Net/Michael Bryzgalov
comment:5 Changed 9 years ago by
It's still unclear what bug you're trying to report. Anything to do with extending native Objects is out of scope for jQuery.
comment:6 Changed 9 years ago by
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
comment:7 Changed 9 years ago by
Resolution: | → duplicate |
---|---|
Status: | reopened → closed |
Duplicate of #2721.
http://contribute.jquery.org/wont-fix/