mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
going to version 0.1.1 with noConflict
This commit is contained in:
16
index.html
16
index.html
@@ -102,11 +102,11 @@
|
|||||||
<p>
|
<p>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="underscore.js">Development Version</a></td>
|
<td><a href="underscore.js">Development Version (0.1.1)</a></td>
|
||||||
<td><i>16kb, Uncompressed with Comments</i></td>
|
<td><i>16kb, Uncompressed with Comments</i></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="underscore-min.js">Production Version</a></td>
|
<td><a href="underscore-min.js">Production Version (0.1.1)</a></td>
|
||||||
<td><i>4kb, Packed and Gzipped</i></td>
|
<td><i>4kb, Packed and Gzipped</i></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -151,7 +151,8 @@
|
|||||||
<p>
|
<p>
|
||||||
<b>Utility</b>
|
<b>Utility</b>
|
||||||
<br />
|
<br />
|
||||||
<span class="methods"><a href="#uniqueId">uniqueId</a>, <a href="#template">template</a></span>
|
<span class="methods"><a href="#noConflict">noConflict</a>,
|
||||||
|
<a href="#uniqueId">uniqueId</a>, <a href="#template">template</a></span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div id="documentation">
|
<div id="documentation">
|
||||||
@@ -649,6 +650,15 @@ _.isUndefined(window.missingVariable);
|
|||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h2>Utility Functions</h2>
|
<h2>Utility Functions</h2>
|
||||||
|
|
||||||
|
<p id="noConflict">
|
||||||
|
<b class="method_name">noConflict</b><code>_.noConflict()</code>
|
||||||
|
<br />
|
||||||
|
Give control of the "_" variable back to its previous owner. Returns
|
||||||
|
a reference to the <b>Underscore</b> object.
|
||||||
|
</p>
|
||||||
|
<pre>
|
||||||
|
var underscore = _.noConflict();</pre>
|
||||||
|
|
||||||
<p id="uniqueId">
|
<p id="uniqueId">
|
||||||
<b class="method_name">uniqueId</b><code>_.uniqueId([prefix])</code>
|
<b class="method_name">uniqueId</b><code>_.uniqueId([prefix])</code>
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
module("Utility functions (uniqueId, template)");
|
module("Utility functions (uniqueId, template)");
|
||||||
|
|
||||||
|
test("utility: noConflict", function() {
|
||||||
|
var underscore = _.noConflict();
|
||||||
|
ok(underscore.isUndefined(_), "The '_' variable has been returned to its previous state.");
|
||||||
|
window._ = underscore;
|
||||||
|
});
|
||||||
|
|
||||||
test("utility: uniqueId", function() {
|
test("utility: uniqueId", function() {
|
||||||
var ids = [], i = 0;
|
var ids = [], i = 0;
|
||||||
|
|||||||
2
underscore-min.js
vendored
2
underscore-min.js
vendored
File diff suppressed because one or more lines are too long
@@ -5,9 +5,11 @@
|
|||||||
// Oliver Steele's Functional, And John Resig's Micro-Templating.
|
// Oliver Steele's Functional, And John Resig's Micro-Templating.
|
||||||
// For all details and documentation:
|
// For all details and documentation:
|
||||||
// http://documentcloud.github.com/underscore/
|
// http://documentcloud.github.com/underscore/
|
||||||
window._ = {
|
window.Underscore = {
|
||||||
|
|
||||||
VERSION : '0.1.0',
|
VERSION : '0.1.1',
|
||||||
|
|
||||||
|
PREVIOUS_UNDERSCORE : window._,
|
||||||
|
|
||||||
/*------------------------ Collection Functions: ---------------------------*/
|
/*------------------------ Collection Functions: ---------------------------*/
|
||||||
|
|
||||||
@@ -387,6 +389,13 @@ window._ = {
|
|||||||
|
|
||||||
/* -------------------------- Utility Functions: -------------------------- */
|
/* -------------------------- Utility Functions: -------------------------- */
|
||||||
|
|
||||||
|
// Run Underscore.js in noConflict mode, returning the '_' variable to its
|
||||||
|
// previous owner. Returns a reference to the Underscore object.
|
||||||
|
noConflict : function() {
|
||||||
|
window._ = Underscore.PREVIOUS_UNDERSCORE;
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
// Generate a unique integer id (unique within the entire client session).
|
// Generate a unique integer id (unique within the entire client session).
|
||||||
// Useful for temporary DOM ids.
|
// Useful for temporary DOM ids.
|
||||||
uniqueId : function(prefix) {
|
uniqueId : function(prefix) {
|
||||||
@@ -413,3 +422,5 @@ window._ = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
window._ = Underscore;
|
||||||
|
|||||||
Reference in New Issue
Block a user