',{})
+ },20)
+
+ })
+
+
$("#qunit-test-area").html("");
stop();
var i = 0;
- $("#qunit-test-area").html("//jquery/view/test/qunit/temp.ejs",{"message" :"helloworld"}, function(text){
+ $("#qunit-test-area").html("//jquery/view/test/qunit/temp.ejs",{"message" :"helloworld"}, function(frag){
ok( /helloworld\s*/.test( $("#qunit-test-area").text()))
- ok(/helloworld\s*/.test(text), "we got a rendered template");
+ equal(frag.nodeType, 11, "we got a documentFragment");
i++;
equals(i, 2, "Ajax is not synchronous");
equals(this.attr("id"), "qunit-test-area" )
From 69f72161334d938b7ed9ddd64fe61bc7eb210d4a Mon Sep 17 00:00:00 2001
From: David Luecke
Date: Wed, 6 Feb 2013 14:55:37 -0700
Subject: [PATCH 032/105] Changing jQuery references to local $. Closes #67,
closes #68
---
dom/animate/animate.js | 2 +-
dom/animate/animate_test.js | 218 +++++++++++++++++-----------------
dom/closest/closest.js | 4 +-
dom/compare/compare.js | 2 +-
dom/cookie/cookie.js | 12 +-
dom/styles/styles.js | 2 +-
dom/within/within.js | 10 +-
event/default/default.js | 6 +-
event/destroyed/destroyed.js | 2 +-
event/drop/drop.js | 2 +-
event/fastfix/fastfix.js | 10 +-
event/fastfix/fastfix_test.js | 106 ++++++++---------
event/handle/handle.js | 36 +++---
event/key/key.js | 2 +-
event/livehack/livehack.js | 2 +-
event/pause/pause.js | 10 +-
model/list/list_test.js | 2 +-
17 files changed, 214 insertions(+), 214 deletions(-)
diff --git a/dom/animate/animate.js b/dom/animate/animate.js
index 148e4216..1fe257a7 100644
--- a/dom/animate/animate.js
+++ b/dom/animate/animate.js
@@ -212,7 +212,7 @@ steal('jquery', 'jquery/dom/styles', function ($) {
return oldanimate.apply(this, arguments);
}
- var optall = jQuery.speed(speed, easing, callback);
+ var optall = $.speed(speed, easing, callback);
// Add everything to the animation queue
this.queue(optall.queue, function(done) {
diff --git a/dom/animate/animate_test.js b/dom/animate/animate_test.js
index c8294360..58628c17 100644
--- a/dom/animate/animate_test.js
+++ b/dom/animate/animate_test.js
@@ -2,7 +2,7 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
module("jquery/dom/animate");
- if ( jQuery.fx ) {
+ if ( $.fx ) {
test("sanity check", function() {
expect(1);
ok( jQuery("#dl:visible, #qunit-fixture:visible, #foo:visible").length === 3, "QUnit state is correct for testing effects" );
@@ -25,13 +25,13 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
hiddendiv = jQuery("div.hidden");
- equal(jQuery.css( hiddendiv[0], "display"), "none", "hiddendiv is display: none");
+ equal($.css( hiddendiv[0], "display"), "none", "hiddendiv is display: none");
hiddendiv.css("display", "block");
- equal(jQuery.css( hiddendiv[0], "display"), "block", "hiddendiv is display: block");
+ equal($.css( hiddendiv[0], "display"), "block", "hiddendiv is display: block");
hiddendiv.show();
- equal(jQuery.css( hiddendiv[0], "display"), "block", "hiddendiv is display: block");
+ equal($.css( hiddendiv[0], "display"), "block", "hiddendiv is display: block");
hiddendiv.css("display","");
@@ -50,7 +50,7 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
"false speed": false
};
- jQuery.each(speeds, function(name, speed) {
+ $.each(speeds, function(name, speed) {
pass = true;
div.hide().show(speed).each(function() {
if ( this.style.display == "none" ) {
@@ -60,7 +60,7 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
ok( pass, "Show with " + name);
});
- jQuery.each(speeds, function(name, speed) {
+ $.each(speeds, function(name, speed) {
pass = true;
div.hide().show(speed, function() {
pass = false;
@@ -91,7 +91,7 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
"li" : old ? "block" : "list-item"
};
- jQuery.each(test, function(selector, expected) {
+ $.each(test, function(selector, expected) {
var elem = jQuery(selector, "#show-tests").show();
equal( elem.css("display"), expected, "Show using correct display type for " + selector );
});
@@ -132,7 +132,7 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
"li" : old ? "block" : "list-item"
};
- jQuery.each(test, function(selector, expected) {
+ $.each(test, function(selector, expected) {
var elem = jQuery(selector, "#show-tests").show(1, function() {
equal( elem.css("display"), expected, "Show using correct display type for " + selector );
if ( ++num === 15 ) {
@@ -181,7 +181,7 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
expect(1);
stop();
var hash = {opacity: "show"};
- var hashCopy = jQuery.extend({}, hash);
+ var hashCopy = $.extend({}, hash);
jQuery("#foo").animate(hash, 0, function() {
equal( hash.opacity, hashCopy.opacity, "Check if animate changed the hash parameter" );
start();
@@ -232,11 +232,11 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
span.remove();
- if ( jQuery.support.inlineBlockNeedsLayout || expected === "inline-block" ) {
+ if ( $.support.inlineBlockNeedsLayout || expected === "inline-block" ) {
stop();
jQuery("#foo").css({ display: "inline", width: "", height: "" }).animate({ width: 42, height: 42 }, 100, function() {
- equal( jQuery(this).css("display"), jQuery.support.inlineBlockNeedsLayout ? "inline" : "inline-block", "inline-block was set on non-floated inline element when animating width/height" );
+ equal( jQuery(this).css("display"), $.support.inlineBlockNeedsLayout ? "inline" : "inline-block", "inline-block was set on non-floated inline element when animating width/height" );
equal( this.offsetWidth, 42, "width was animated" );
equal( this.offsetHeight, 42, "height was animated" );
start();
@@ -258,7 +258,7 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
span.remove();
- if ( jQuery.support.inlineBlockNeedsLayout || expected === "inline-block" ) {
+ if ( $.support.inlineBlockNeedsLayout || expected === "inline-block" ) {
stop();
jQuery("#foo").css({ display: "", width: "", height: "" })
.append("text")
@@ -486,7 +486,7 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
var $elems = jQuery([{ a:0 },{ a:0 }]), counter = 0;
- equal( jQuery.timers.length, 0, "Make sure no animation was running from another test" );
+ equal( $.timers.length, 0, "Make sure no animation was running from another test" );
$elems.eq(0).animate( {a:1}, 0, function(){
ok( true, "Animate a simple property." );
@@ -494,7 +494,7 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
});
// Failed until [6115]
- equal( jQuery.timers.length, 0, "Make sure synchronic animations are not left on jQuery.timers" );
+ equal( $.timers.length, 0, "Make sure synchronic animations are not left on $.timers" );
equal( counter, 1, "One synchronic animations" );
@@ -731,17 +731,17 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
ok( x.is(":visible"), "is visible again" );
});
- jQuery.checkOverflowDisplay = function(){
- var o = jQuery.css( this, "overflow" );
+ $.checkOverflowDisplay = function(){
+ var o = $.css( this, "overflow" );
equal(o, "visible", "Overflow should be visible: " + o);
- equal(jQuery.css( this, "display" ), "inline", "Display shouldn't be tampered with.");
+ equal($.css( this, "display" ), "inline", "Display shouldn't be tampered with.");
jQuery(this).remove();
start();
};
- test( "jQuery.fx.prototype.cur() - <1.8 Back Compat", 7, function() {
+ test( "$.fx.prototype.cur() - <1.8 Back Compat", 7, function() {
var div = jQuery( "" ).appendTo( "#qunit-fixture" ).css({
color: "#ABC",
border: "5px solid black",
@@ -750,13 +750,13 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
})[0];
equal(
- ( new jQuery.fx( div, {}, "color" ) ).cur(),
- jQuery.css( div, "color" ),
- "Return the same value as jQuery.css for complex properties (bug #7912)"
+ ( new $.fx( div, {}, "color" ) ).cur(),
+ $.css( div, "color" ),
+ "Return the same value as $.css for complex properties (bug #7912)"
);
strictEqual(
- ( new jQuery.fx( div, {}, "borderLeftWidth" ) ).cur(),
+ ( new $.fx( div, {}, "borderLeftWidth" ) ).cur(),
5,
"Return simple values parsed as Float"
);
@@ -765,7 +765,7 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
// this fakes a "" return
// hook now gets called twice because Tween will grab the current
// value as it is being newed
- jQuery.cssHooks.backgroundPosition = {
+ $.cssHooks.backgroundPosition = {
get: function() {
ok( true, "hook used" );
return "";
@@ -773,21 +773,21 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
};
strictEqual(
- ( new jQuery.fx( div, {}, "backgroundPosition" ) ).cur(),
+ ( new $.fx( div, {}, "backgroundPosition" ) ).cur(),
0,
- "Return 0 when jQuery.css returns an empty string"
+ "Return 0 when $.css returns an empty string"
);
- delete jQuery.cssHooks.backgroundPosition;
+ delete $.cssHooks.backgroundPosition;
strictEqual(
- ( new jQuery.fx( div, {}, "left" ) ).cur(),
+ ( new $.fx( div, {}, "left" ) ).cur(),
0,
- "Return 0 when jQuery.css returns 'auto'"
+ "Return 0 when $.css returns 'auto'"
);
equal(
- ( new jQuery.fx( div, {}, "marginBottom" ) ).cur(),
+ ( new $.fx( div, {}, "marginBottom" ) ).cur(),
-11000,
"support negative values < -10000 (bug #7193)"
);
@@ -798,29 +798,29 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
test("JS Overflow and Display", function() {
expect(2);
stop();
- jQuery.makeTest( "JS Overflow and Display" )
+ $.makeTest( "JS Overflow and Display" )
.addClass("widewidth")
.css({ overflow: "visible", display: "inline" })
.addClass("widewidth")
.text("Some sample text.")
.before("text before")
.after("text after")
- .animate({ opacity: 0.5 }, "slow", jQuery.checkOverflowDisplay);
+ .animate({ opacity: 0.5 }, "slow", $.checkOverflowDisplay);
});
test("CSS Overflow and Display", function() {
expect(2);
stop();
- jQuery.makeTest( "CSS Overflow and Display" )
+ $.makeTest( "CSS Overflow and Display" )
.addClass("overflow inline")
.addClass("widewidth")
.text("Some sample text.")
.before("text before")
.after("text after")
- .animate({ opacity: 0.5 }, "slow", jQuery.checkOverflowDisplay);
+ .animate({ opacity: 0.5 }, "slow", $.checkOverflowDisplay);
});
- jQuery.each({
+ $.each({
"CSS Auto": function( elem, prop ) {
jQuery( elem ).addClass( "auto" + prop )
.text( "This is a long string of text." );
@@ -856,7 +856,7 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
return 0;
}
}, function( fn, f ) {
- jQuery.each({
+ $.each({
"show": function( elem, prop ) {
jQuery( elem ).hide( ).addClass( "wide" + prop );
return "show";
@@ -878,7 +878,7 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
}
}, function( tn, t ) {
test(fn + " to " + tn, function() {
- var elem = jQuery.makeTest( fn + " to " + tn );
+ var elem = $.makeTest( fn + " to " + tn );
var t_w = t( elem, "width" );
var f_w = f( elem, "width" );
@@ -910,7 +910,7 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
elem.animate(anim, 50);
- jQuery.when( elem ).done(function( elem ) {
+ $.when( elem ).done(function( elem ) {
elem = elem[ 0 ];
@@ -926,9 +926,9 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
ok( f_h === "" ? elem.style.height === f_h : elem.style.height.indexOf( f_h ) === 0, "Height must be reset to " + f_h + ": " + elem.style.height );
}
- var cur_o = jQuery.style(elem, "opacity");
+ var cur_o = $.style(elem, "opacity");
- if ( f_o !== jQuery.css(elem, "opacity") ) {
+ if ( f_o !== $.css(elem, "opacity") ) {
f_o = f( elem, "opacity" );
}
@@ -953,13 +953,13 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
if ( t_o.constructor == Number ) {
equal( cur_o, t_o, "Final opacity should be " + t_o + ": " + cur_o );
- ok( jQuery.css(elem, "opacity") !== "" || cur_o == t_o, "Opacity should be explicitly set to " + t_o + ", is instead: " + cur_o );
+ ok( $.css(elem, "opacity") !== "" || cur_o == t_o, "Opacity should be explicitly set to " + t_o + ", is instead: " + cur_o );
}
if ( t_w.constructor == Number ) {
equal( elem.style.width, t_w + "px", "Final width should be " + t_w + ": " + elem.style.width );
- var cur_w = jQuery.css( elem,"width" );
+ var cur_w = $.css( elem,"width" );
ok( elem.style.width !== "" || cur_w == t_w, "Width should be explicitly set to " + t_w + ", is instead: " + cur_w );
}
@@ -967,19 +967,19 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
if ( t_h.constructor == Number ) {
equal( elem.style.height, t_h + "px", "Final height should be " + t_h + ": " + elem.style.height );
- var cur_h = jQuery.css( elem,"height" );
+ var cur_h = $.css( elem,"height" );
ok( elem.style.height !== "" || cur_h == t_h, "Height should be explicitly set to " + t_h + ", is instead: " + cur_h );
}
if ( t_h == "show" ) {
- var old_h = jQuery.css( elem, "height" );
+ var old_h = $.css( elem, "height" );
jQuery( elem ).append(" Some more text and some more...");
if ( /Auto/.test( fn ) ) {
- notEqual( jQuery.css( elem, "height" ), old_h, "Make sure height is auto." );
+ notEqual( $.css( elem, "height" ), old_h, "Make sure height is auto." );
} else {
- equal( jQuery.css( elem, "height" ), old_h, "Make sure height is not auto." );
+ equal( $.css( elem, "height" ), old_h, "Make sure height is not auto." );
}
}
@@ -992,7 +992,7 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
});
});
- jQuery.fn.saveState = function( hiddenOverflow ) {
+ $.fn.saveState = function( hiddenOverflow ) {
var check = ["opacity", "height", "width", "display", "overflow"];
expect(check.length);
@@ -1000,84 +1000,84 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
return this.each(function(){
var self = this;
self.save = {};
- jQuery.each(check, function( i, c ) {
- self.save[ c ] = c === "overflow" && hiddenOverflow ? "hidden" : self.style[ c ] || jQuery.css( self, c );
+ $.each(check, function( i, c ) {
+ self.save[ c ] = c === "overflow" && hiddenOverflow ? "hidden" : self.style[ c ] || $.css( self, c );
});
});
};
/** @expose */
- jQuery.checkState = function() {
+ $.checkState = function() {
var self = this;
- jQuery.each(this.save, function( c, v ) {
- var cur = self.style[ c ] || jQuery.css( self, c );
+ $.each(this.save, function( c, v ) {
+ var cur = self.style[ c ] || $.css( self, c );
equal( cur, v, "Make sure that " + c + " is reset (Old: " + v + " Cur: " + cur + ")");
});
// manually clean data on modified element
- jQuery.removeData( this, "olddisplay", true );
+ $.removeData( this, "olddisplay", true );
start();
};
// Chaining Tests
test("Chain fadeOut fadeIn", function() {
- jQuery("#fadein div").saveState().fadeOut("fast").fadeIn("fast", jQuery.checkState );
+ jQuery("#fadein div").saveState().fadeOut("fast").fadeIn("fast", $.checkState );
});
test("Chain fadeIn fadeOut", function() {
- jQuery("#fadeout div").saveState().fadeIn("fast").fadeOut("fast", jQuery.checkState );
+ jQuery("#fadeout div").saveState().fadeIn("fast").fadeOut("fast", $.checkState );
});
test("Chain hide show", function() {
- jQuery("#show div").saveState( jQuery.support.shrinkWrapBlocks ).hide("fast").show("fast", jQuery.checkState );
+ jQuery("#show div").saveState( $.support.shrinkWrapBlocks ).hide("fast").show("fast", $.checkState );
});
test("Chain show hide", function() {
- jQuery("#hide div").saveState( jQuery.support.shrinkWrapBlocks ).show("fast").hide("fast", jQuery.checkState );
+ jQuery("#hide div").saveState( $.support.shrinkWrapBlocks ).show("fast").hide("fast", $.checkState );
});
test("Chain show hide with easing and callback", function() {
- jQuery("#hide div").saveState().show("fast").hide("fast","linear", jQuery.checkState );
+ jQuery("#hide div").saveState().show("fast").hide("fast","linear", $.checkState );
});
test("Chain toggle in", function() {
- jQuery("#togglein div").saveState( jQuery.support.shrinkWrapBlocks ).toggle("fast").toggle("fast", jQuery.checkState );
+ jQuery("#togglein div").saveState( $.support.shrinkWrapBlocks ).toggle("fast").toggle("fast", $.checkState );
});
test("Chain toggle out", function() {
- jQuery("#toggleout div").saveState( jQuery.support.shrinkWrapBlocks ).toggle("fast").toggle("fast", jQuery.checkState );
+ jQuery("#toggleout div").saveState( $.support.shrinkWrapBlocks ).toggle("fast").toggle("fast", $.checkState );
});
test("Chain toggle out with easing and callback", function() {
- jQuery("#toggleout div").saveState( jQuery.support.shrinkWrapBlocks ).toggle("fast").toggle("fast","linear", jQuery.checkState );
+ jQuery("#toggleout div").saveState( $.support.shrinkWrapBlocks ).toggle("fast").toggle("fast","linear", $.checkState );
});
test("Chain slideDown slideUp", function() {
- jQuery("#slidedown div").saveState( jQuery.support.shrinkWrapBlocks ).slideDown("fast").slideUp("fast", jQuery.checkState );
+ jQuery("#slidedown div").saveState( $.support.shrinkWrapBlocks ).slideDown("fast").slideUp("fast", $.checkState );
});
test("Chain slideUp slideDown", function() {
- jQuery("#slideup div").saveState( jQuery.support.shrinkWrapBlocks ).slideUp("fast").slideDown("fast", jQuery.checkState );
+ jQuery("#slideup div").saveState( $.support.shrinkWrapBlocks ).slideUp("fast").slideDown("fast", $.checkState );
});
test("Chain slideUp slideDown with easing and callback", function() {
- jQuery("#slideup div").saveState( jQuery.support.shrinkWrapBlocks ).slideUp("fast").slideDown("fast","linear", jQuery.checkState );
+ jQuery("#slideup div").saveState( $.support.shrinkWrapBlocks ).slideUp("fast").slideDown("fast","linear", $.checkState );
});
test("Chain slideToggle in", function() {
- jQuery("#slidetogglein div").saveState( jQuery.support.shrinkWrapBlocks ).slideToggle("fast").slideToggle("fast", jQuery.checkState );
+ jQuery("#slidetogglein div").saveState( $.support.shrinkWrapBlocks ).slideToggle("fast").slideToggle("fast", $.checkState );
});
test("Chain slideToggle out", function() {
- jQuery("#slidetoggleout div").saveState( jQuery.support.shrinkWrapBlocks ).slideToggle("fast").slideToggle("fast", jQuery.checkState );
+ jQuery("#slidetoggleout div").saveState( $.support.shrinkWrapBlocks ).slideToggle("fast").slideToggle("fast", $.checkState );
});
test("Chain fadeToggle in", function() {
- jQuery("#fadetogglein div").saveState().fadeToggle("fast").fadeToggle("fast", jQuery.checkState );
+ jQuery("#fadetogglein div").saveState().fadeToggle("fast").fadeToggle("fast", $.checkState );
});
test("Chain fadeToggle out", function() {
- jQuery("#fadetoggleout div").saveState().fadeToggle("fast").fadeToggle("fast", jQuery.checkState );
+ jQuery("#fadetoggleout div").saveState().fadeToggle("fast").fadeToggle("fast", $.checkState );
});
test("Chain fadeTo 0.5 1.0 with easing and callback)", function() {
- jQuery("#fadeto div").saveState().fadeTo("fast",0.5).fadeTo("fast",1.0,"linear", jQuery.checkState );
+ jQuery("#fadeto div").saveState().fadeTo("fast",0.5).fadeTo("fast",1.0,"linear", $.checkState );
});
- jQuery.makeTest = function( text ){
+ $.makeTest = function( text ){
var elem = jQuery("")
- .attr( "id", "test" + jQuery.makeTest.id++ )
+ .attr( "id", "test" + $.makeTest.id++ )
.addClass("box");
jQuery("")
@@ -1088,9 +1088,9 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
return elem;
};
- jQuery.makeTest.id = 1;
+ $.makeTest.id = 1;
- test("jQuery.show('fast') doesn't clear radio buttons (bug #1095)", function () {
+ test("$.show('fast') doesn't clear radio buttons (bug #1095)", function () {
expect(4);
stop();
@@ -1105,8 +1105,8 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
});
});
- jQuery.expandedEach = jQuery.each;
- jQuery.expandedEach({
+ $.expandedEach = $.each;
+ $.expandedEach({
"slideToggle": function( $elem ) {
return parseFloat( $elem.css("height") );
},
@@ -1123,7 +1123,7 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
var animTime = 2000;
- jQuery.each([ "in", "out" ], function( i, type ) {
+ $.each([ "in", "out" ], function( i, type ) {
var $elem = jQuery( "#" + method.toLowerCase() + type ),
startVal = defProp( $elem );
@@ -1149,7 +1149,7 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
equal( defProp( $elem ), startVal, "After doing .stop() halfway through show, check that state has been saved for returning to original property value." );
// Remove olddisplay data from .hide() call
- jQuery.removeData( this, "olddisplay", true );
+ $.removeData( this, "olddisplay", true );
start();
});
}, animTime / 2);
@@ -1174,17 +1174,17 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
c: 100
};
- jQuery.easing["_test1"] = function(p) {
+ $.easing["_test1"] = function(p) {
_test1_called = true;
return p;
};
- jQuery.easing["_test2"] = function(p) {
+ $.easing["_test2"] = function(p) {
_test2_called = true;
return p;
};
- jQuery.easing["_default_test"] = function(p) {
+ $.easing["_default_test"] = function(p) {
_default_test_called = true;
return p;
};
@@ -1210,14 +1210,14 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
propsBasic = { "padding": "10 20 30" },
propsSpecial = { "padding": [ "1 2 3", "_special" ] };
- jQuery.easing._default = function(p) {
+ $.easing._default = function(p) {
if ( p >= 1 ) {
_default_count++;
}
return p;
};
- jQuery.easing._special = function(p) {
+ $.easing._special = function(p) {
if ( p >= 1 ) {
_special_count++;
}
@@ -1242,8 +1242,8 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
equal( _special_count, 4, "special easing called for each property" );
jQuery(this).css("padding", "0");
- delete jQuery.easing._default;
- delete jQuery.easing._special;
+ delete $.easing._default;
+ delete $.easing._special;
start();
});
});
@@ -1256,7 +1256,7 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
var div = jQuery("").appendTo("#qunit-fixture");
equal( div.css("display"), "none", "Element is hidden by default" );
div.hide(1, function () {
- ok( !jQuery._data(div, "olddisplay"), "olddisplay is undefined after hiding an already-hidden element" );
+ ok( !$._data(div, "olddisplay"), "olddisplay is undefined after hiding an already-hidden element" );
div.show(1, function () {
equal( div.css("display"), "block", "Show a double-hidden element" );
start();
@@ -1333,15 +1333,15 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
// with any changes internally to these functions.
// make sure that the standard timer loop will NOT run.
- jQuery.fx.stop();
+ $.fx.stop();
setTimeout(function() {
// the first call to fx.tick should raise the callback exception
- raises( jQuery.fx.tick, testException, "Exception was thrown" );
+ raises( $.fx.tick, testException, "Exception was thrown" );
// the second call shouldn't
- jQuery.fx.tick();
+ $.fx.tick();
ok( true, "Test completed without throwing a second exception" );
@@ -1386,7 +1386,7 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
});
// Start 1.8 Animation tests
- asyncTest( "jQuery.Animation( object, props, opts )", 4, function() {
+ asyncTest( "$.Animation( object, props, opts )", 4, function() {
var testObject = {
"foo": 0,
"bar": 1,
@@ -1398,7 +1398,7 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
"width": 200
};
- var animation = jQuery.Animation( testObject, testDest, { "duration": 1 });
+ var animation = $.Animation( testObject, testDest, { "duration": 1 });
animation.done(function() {
for ( var prop in testDest ) {
equal( testObject[ prop ], testDest[ prop ], "Animated: " + prop );
@@ -1452,13 +1452,13 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
asyncTest( "User supplied callback called after show when fx off (#8892)", 2, function() {
var foo = jQuery( "#foo" );
- jQuery.fx.off = true;
+ $.fx.off = true;
foo.hide();
foo.fadeIn( 500, function() {
ok( jQuery( this ).is( ":visible" ), "Element is visible in callback" );
foo.fadeOut( 500, function() {
ok( jQuery( this ).is( ":hidden" ), "Element is hidden in callback" );
- jQuery.fx.off = false;
+ $.fx.off = false;
start();
});
});
@@ -1496,13 +1496,13 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
strictEqual( elems[ 3 ].show()[ 0 ].style.display, "block", "show() should change display if it already set to none" );
// cleanup
- jQuery.each( elems, function() {
- jQuery.removeData( this[ 0 ], "olddisplay", true );
+ $.each( elems, function() {
+ $.removeData( this[ 0 ], "olddisplay", true );
});
stop();
- jQuery.each( methods, function( name, opt ) {
- jQuery.each([
+ $.each( methods, function( name, opt ) {
+ $.each([
// parentNode = document fragment
jQuery("
test
"),
@@ -1514,13 +1514,13 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
var callback = [function () {
strictEqual( this.style.display, "block", "set display to block with " + name );
- jQuery.removeData( this, "olddisplay", true );
+ $.removeData( this, "olddisplay", true );
if ( ++i === 14 ) {
start();
}
}];
- jQuery.fn[ name ].apply( this, opt.concat( callback ) );
+ $.fn[ name ].apply( this, opt.concat( callback ) );
});
});
});
@@ -1542,7 +1542,7 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
hidden.append( elems );
- jQuery.when(
+ $.when(
elems.eq( 0 ).hide(),
elems.eq( 1 ).hide( 0 ),
elems.eq( 2 ).hide( 1 )
@@ -1567,16 +1567,16 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
foo.append( elems );
- jQuery.when(
+ $.when(
elems.eq( 0 ).hide(),
- elems.eq( 1 ).hide( jQuery.noop ),
+ elems.eq( 1 ).hide( $.noop ),
elems.eq( 2 ).hide( 1 ),
elems.eq( 3 ).fadeOut(),
elems.eq( 4 ).slideUp()
).done(function() {
strictEqual( elems.get( 0 ).style.display, "none", "hide() called on element width height and width = 0 should set display to none" );
strictEqual( elems.get( 1 ).style.display, "none",
- "hide( jQuery.noop ) called on element width height and width = 0 should set display to none" );
+ "hide( $.noop ) called on element width height and width = 0 should set display to none" );
strictEqual( elems.get( 2 ).style.display, "none", "hide( 1 ) called on element width height and width = 0 should set display to none" );
strictEqual( elems.get( 3 ).style.display, "none", "fadeOut() called on element width height and width = 0 should set display to none" );
strictEqual( elems.get( 4 ).style.display, "none", "slideUp() called on element width height and width = 0 should set display to none" );
@@ -1705,13 +1705,13 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
}
if ( parseFloat( initial ) ) {
- equal( jQuery.style( this, "backgroundPositionX" ), initial, "Numeric start preserved" );
+ equal( $.style( this, "backgroundPositionX" ), initial, "Numeric start preserved" );
} else {
- equal( jQuery.style( this, "backgroundPositionX" ), "0%", "Non-numeric start zeroed" );
+ equal( $.style( this, "backgroundPositionX" ), "0%", "Non-numeric start zeroed" );
}
},
done: function() {
- equal( jQuery.style( this, "backgroundPositionX" ), "42%", "End reached" );
+ equal( $.style( this, "backgroundPositionX" ), "42%", "End reached" );
start();
}
});
@@ -1799,8 +1799,8 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
});
test( "Animate properly sets overflow hidden when animating width/height (#12117)", 4, function() {
- jQuery.each( [ "height", "width" ], function( _, prop ) {
- jQuery.each( [ 100, 0 ], function( _, value ) {
+ $.each( [ "height", "width" ], function( _, prop ) {
+ $.each( [ 100, 0 ], function( _, value ) {
var div = jQuery("
"),
props = {};
props[ prop ] = value;
@@ -1813,7 +1813,7 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
});
test( "Animations with 0 duration don't ease (#12273)", 1, function() {
- jQuery.easing.test = function() {
+ $.easing.test = function() {
ok( false, "Called easing" );
};
@@ -1827,8 +1827,8 @@ steal('jquery', 'jquery/dom/animate', 'funcunit/qunit', 'qunit.css', function ($
}
});
- delete jQuery.easing.test;
+ delete $.easing.test;
});
- } // if ( jQuery.fx )
+ } // if ( $.fx )
});
\ No newline at end of file
diff --git a/dom/closest/closest.js b/dom/closest/closest.js
index 4460647b..237fd0bc 100644
--- a/dom/closest/closest.js
+++ b/dom/closest/closest.js
@@ -11,8 +11,8 @@ steal('jquery', function($) {
*
* ">li click" : function( el, ev ) { ... }
*/
- var oldClosest = jQuery.fn.closest;
- jQuery.fn.closest = function(selectors, context){
+ var oldClosest = $.fn.closest;
+ $.fn.closest = function(selectors, context){
var rooted = {}, res, result, thing, i, j, selector, rootedIsEmpty = true, selector, selectorsArr = selectors;
if(typeof selectors == "string") selectorsArr = [selectors];
diff --git a/dom/compare/compare.js b/dom/compare/compare.js
index ee81f442..21539523 100644
--- a/dom/compare/compare.js
+++ b/dom/compare/compare.js
@@ -24,7 +24,7 @@ steal('jquery', function($) {
*/
// See http://ejohn.org/blog/comparing-document-position/
-jQuery.fn.compare = function(element){ //usually
+$.fn.compare = function(element){ //usually
try{
// Firefox 3 throws an error with XUL - we can't use compare then
element = element.jquery ? element[0] : element;
diff --git a/dom/cookie/cookie.js b/dom/cookie/cookie.js
index c4b0035b..9416d120 100644
--- a/dom/cookie/cookie.js
+++ b/dom/cookie/cookie.js
@@ -49,7 +49,7 @@ steal('jquery', 'jquery/lang/json', function($) {
*
* @return {String} the value of the cookie or {undefined} when setting the cookie.
*/
- jQuery.cookie = function(name, value, options) {
+ $.cookie = function(name, value, options) {
if (typeof value != 'undefined') {
// name and value given, set cookie
options = options ||
@@ -59,8 +59,8 @@ steal('jquery', 'jquery/lang/json', function($) {
options.expires = -1;
}
// convert value to JSON string
- if (typeof value == 'object' && jQuery.toJSON) {
- value = jQuery.toJSON(value);
+ if (typeof value == 'object' && $.toJSON) {
+ value = $.toJSON(value);
}
var expires = '';
// Set expiry
@@ -89,7 +89,7 @@ steal('jquery', 'jquery/lang/json', function($) {
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
- var cookie = jQuery.trim(cookies[i]);
+ var cookie = $.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
// Get the cookie value
@@ -99,9 +99,9 @@ steal('jquery', 'jquery/lang/json', function($) {
}
}
// Parse JSON from the cookie into an object
- if (jQuery.evalJSON && cookieValue && cookieValue.match(/^\s*\{/)) {
+ if ($.evalJSON && cookieValue && cookieValue.match(/^\s*\{/)) {
try {
- cookieValue = jQuery.evalJSON(cookieValue);
+ cookieValue = $.evalJSON(cookieValue);
}
catch (e) {
}
diff --git a/dom/styles/styles.js b/dom/styles/styles.js
index babfe151..1de61dde 100644
--- a/dom/styles/styles.js
+++ b/dom/styles/styles.js
@@ -38,7 +38,7 @@ steal('jquery', function( $ ) {
oldName = name.replace(rdashAlpha, fcamelCase);
if ( rfloat.test(name) ) {
- name = jQuery.support.cssFloat ? "float" : "styleFloat";
+ name = $.support.cssFloat ? "float" : "styleFloat";
oldName = "cssFloat";
}
diff --git a/dom/within/within.js b/dom/within/within.js
index 22e39a11..a3555e1c 100644
--- a/dom/within/within.js
+++ b/dom/within/within.js
@@ -33,7 +33,7 @@ $.fn.within= function(left, top, useOffsetCache) {
// uses either the cached offset or .offset()
var offset = useOffsetCache ?
- jQuery.data(this,"offsetCache") || jQuery.data(this,"offsetCache", q.offset()) :
+ $.data(this,"offsetCache") || $.data(this,"offsetCache", q.offset()) :
q.offset();
// Check if the given coordinates are within the area of the current element
@@ -46,7 +46,7 @@ $.fn.within= function(left, top, useOffsetCache) {
}
});
- return this.pushStack( jQuery.unique( ret ), "within", left+","+top );
+ return this.pushStack( $.unique( ret ), "within", left+","+top );
}
@@ -75,8 +75,8 @@ $.fn.withinBox = function(left, top, width, height, useOffsetCache){
// use cached offset or .offset()
var offset = useOffsetCache ?
- jQuery.data(this,"offset") ||
- jQuery.data(this,"offset", q.offset()) :
+ $.data(this,"offset") ||
+ $.data(this,"offset", q.offset()) :
q.offset();
@@ -87,7 +87,7 @@ $.fn.withinBox = function(left, top, width, height, useOffsetCache){
if(res)
ret.push(this);
});
- return this.pushStack( jQuery.unique( ret ), "withinBox", jQuery.makeArray(arguments).join(",") );
+ return this.pushStack( $.unique( ret ), "withinBox", $.makeArray(arguments).join(",") );
}
return $;
diff --git a/event/default/default.js b/event/default/default.js
index f3d26ae2..6c3f39d6 100644
--- a/event/default/default.js
+++ b/event/default/default.js
@@ -82,11 +82,11 @@ $event.trigger = function defaultTriggerer( event, data, elem, onlyHandlers){
// Caller can pass in an Event, Object, or just an event type string
event = typeof event === "object" ?
// jQuery.Event object
- event[ jQuery.expando ] ? event :
+ event[ $.expando ] ? event :
// Object literal
- new jQuery.Event( type, event ) :
+ new $.Event( type, event ) :
// Just the event type (string)
- new jQuery.Event( type),
+ new $.Event( type),
res=oldTrigger.call($.event,event, data, elem, onlyHandlers),
paused=event.isPaused && event.isPaused();
diff --git a/event/destroyed/destroyed.js b/event/destroyed/destroyed.js
index cb00616d..d98bdfc5 100644
--- a/event/destroyed/destroyed.js
+++ b/event/destroyed/destroyed.js
@@ -6,7 +6,7 @@ steal('jquery', function( $ ) {
*/
// Store the old jQuery.cleanData
- var oldClean = jQuery.cleanData;
+ var oldClean = $.cleanData;
// Overwrites cleanData which is called by jQuery on manipulation methods
$.cleanData = function( elems ) {
diff --git a/event/drop/drop.js b/event/drop/drop.js
index eaa0d9b7..3e689e37 100644
--- a/event/drop/drop.js
+++ b/event/drop/drop.js
@@ -110,7 +110,7 @@ steal('jquery', 'jquery/event/drag', 'jquery/dom/within', 'jquery/dom/compare',
* });
*/
$.Drop = function(callbacks, element){
- jQuery.extend(this,callbacks);
+ $.extend(this,callbacks);
this.element = $(element);
}
// add the elements ...
diff --git a/event/fastfix/fastfix.js b/event/fastfix/fastfix.js
index 3707b497..fde6ed06 100644
--- a/event/fastfix/fastfix.js
+++ b/event/fastfix/fastfix.js
@@ -61,10 +61,10 @@ steal('jquery', function ($) {
};
// Get all properties that should be mapped
- jQuery.each(jQuery.event.keyHooks.props.concat(jQuery.event.mouseHooks.props).concat(jQuery.event.props), function (i, prop) {
+ $.each($.event.keyHooks.props.concat($.event.mouseHooks.props).concat($.event.props), function (i, prop) {
if (prop !== "target") {
(function () {
- Object.defineProperty(jQuery.Event.prototype, prop, {
+ Object.defineProperty($.Event.prototype, prop, {
get : function () {
// get the original value, undefined when there is no original event
var originalValue = this.originalEvent && this.originalEvent[prop];
@@ -86,13 +86,13 @@ steal('jquery', function ($) {
}
});
- jQuery.event.fix = function (event) {
- if (event[ jQuery.expando ]) {
+ $.event.fix = function (event) {
+ if (event[ $.expando ]) {
return event;
}
// Create a jQuery event with at minimum a target and type set
var originalEvent = event,
- event = jQuery.Event(originalEvent);
+ event = $.Event(originalEvent);
event.target = originalEvent.target;
// Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
if (!event.target) {
diff --git a/event/fastfix/fastfix_test.js b/event/fastfix/fastfix_test.js
index 540ec581..df6dd42a 100644
--- a/event/fastfix/fastfix_test.js
+++ b/event/fastfix/fastfix_test.js
@@ -73,7 +73,7 @@ steal("jquery/event/fastfix",
};
jQuery("#firstp").bind("click", {"foo" : "bar"}, handler).click().unbind("click", handler);
- ok(!jQuery._data(jQuery("#firstp")[0], "events"), "Event handler unbound when using data.");
+ ok(!$._data(jQuery("#firstp")[0], "events"), "Event handler unbound when using data.");
var test = function () {
};
@@ -91,7 +91,7 @@ steal("jquery/event/fastfix",
};
jQuery("#firstp").click({"foo" : "bar"}, handler).click().unbind("click", handler);
- ok(!jQuery._data(jQuery("#firstp")[0], "events"), "Event handler unbound when using data.");
+ ok(!$._data(jQuery("#firstp")[0], "events"), "Event handler unbound when using data.");
});
test("bind(), with data, trigger with data", function () {
@@ -193,7 +193,7 @@ steal("jquery/event/fastfix",
var i = 0;
- jQuery.event.special["test"] = {
+ $.event.special["test"] = {
_default : function (e, data) {
equal(this, document, "Make sure we're at the top of the chain.");
equal(e.type, "test", "And that we're still dealing with a test event.");
@@ -246,7 +246,7 @@ steal("jquery/event/fastfix",
// Should trigger 2
div.appendTo("#qunit-fixture").remove();
- delete jQuery.event.special["test"];
+ delete $.event.special["test"];
});
test("bind(), no data", function () {
@@ -586,7 +586,7 @@ steal("jquery/event/fastfix",
var elem = jQuery("#firstp"), log = [], check = [];
- jQuery.each(new Array(100), function (i) {
+ $.each(new Array(100), function (i) {
elem.bind("click", function () {
log.push(i);
});
@@ -615,10 +615,10 @@ steal("jquery/event/fastfix",
};
jQuery("#firstp")
- .bind("click", jQuery.proxy(handler1, thisObject)).click().unbind("click", handler1)
- .bind("click", data, jQuery.proxy(handler2, thisObject)).click().unbind("click", handler2);
+ .bind("click", $.proxy(handler1, thisObject)).click().unbind("click", handler1)
+ .bind("click", data, $.proxy(handler2, thisObject)).click().unbind("click", handler2);
- ok(!jQuery._data(jQuery("#firstp")[0], "events"), "Event handler unbound when using different this object and data.");
+ ok(!$._data(jQuery("#firstp")[0], "events"), "Event handler unbound when using different this object and data.");
});
test("bind(name, false), unbind(name, false)", function () {
@@ -710,7 +710,7 @@ steal("jquery/event/fastfix",
}
});
- var events = jQuery._data(obj, "events");
+ var events = $._data(obj, "events");
ok(events, "Object has events bound.");
equal(obj["events"], undefined, "Events object on plain objects is not events");
equal(obj["test"], undefined, "Make sure that test event is not on the plain object.");
@@ -729,9 +729,9 @@ steal("jquery/event/fastfix",
// Make sure it doesn't complain when no events are found
jQuery(obj).unbind("test");
- equal(obj && obj[ jQuery.expando ] &&
- obj[ jQuery.expando ][ jQuery.expando ] &&
- obj[ jQuery.expando ][ jQuery.expando ]["events"], undefined, "Make sure events object is removed");
+ equal(obj && obj[ $.expando ] &&
+ obj[ $.expando ][ $.expando ] &&
+ obj[ $.expando ][ $.expando ]["events"], undefined, "Make sure events object is removed");
});
test("unbind(type)", function () {
@@ -880,7 +880,7 @@ steal("jquery/event/fastfix",
elem.remove();
});
- test("withinElement implemented with jQuery.contains()", function () {
+ test("withinElement implemented with $.contains()", function () {
expect(1);
@@ -1194,8 +1194,8 @@ steal("jquery/event/fastfix",
$parent.get(0).style.display = "none";
- var event = jQuery.Event("noNew");
- ok(event != window, "Instantiate jQuery.Event without the 'new' keyword");
+ var event = $.Event("noNew");
+ ok(event != window, "Instantiate $.Event without the 'new' keyword");
equal(event.type, "noNew", "Verify its type");
equal(event.isDefaultPrevented(), false, "Verify isDefaultPrevented");
@@ -1223,7 +1223,7 @@ steal("jquery/event/fastfix",
});
// test with an event object
- event = new jQuery.Event("foo");
+ event = new $.Event("foo");
event.secret = "boo!";
$child.trigger(event);
@@ -1258,7 +1258,7 @@ steal("jquery/event/fastfix",
// in which event handlers are iterated.
//$child.bind("foo", error );
- event = new jQuery.Event("foo");
+ event = new $.Event("foo");
$child.trigger(event, [1, 2, 3]).unbind();
equal(event.result, "result", "Check event.result attribute");
@@ -1269,7 +1269,7 @@ steal("jquery/event/fastfix",
$parent.unbind().remove();
// Ensure triggerHandler doesn't molest its event object (#xxx)
- event = jQuery.Event("zowie");
+ event = $.Event("zowie");
jQuery(document).triggerHandler(event);
equal(event.type, "zowie", "Verify its type");
equal(event.isPropagationStopped(), false, "propagation not stopped");
@@ -1455,21 +1455,21 @@ steal("jquery/event/fastfix",
equal(window.onbeforeunload, null, "window property has been unset to null/undefined");
});
- test("jQuery.Event( type, props )", function () {
+ test("$.Event( type, props )", function () {
expect(5);
- var event = jQuery.Event("keydown", { keyCode : 64 }),
+ var event = $.Event("keydown", { keyCode : 64 }),
handler = function (event) {
ok("keyCode" in event, "Special property 'keyCode' exists");
equal(event.keyCode, 64, "event.keyCode has explicit value '64'");
};
- // Supports jQuery.Event implementation
+ // Supports $.Event implementation
equal(event.type, "keydown", "Verify type");
// ensure "type" in props won't clobber the one set by constructor
- equal(jQuery.inArray("type", jQuery.event.props), -1, "'type' property not in props (#10375)");
+ equal($.inArray("type", $.event.props), -1, "'type' property not in props (#10375)");
ok("keyCode" in event, "Special 'keyCode' property exists");
@@ -1479,7 +1479,7 @@ steal("jquery/event/fastfix",
});
- test("jQuery.Event.currentTarget", function () {
+ test("$.Event.currentTarget", function () {
expect(2);
jQuery("
")
@@ -1555,7 +1555,7 @@ steal("jquery/event/fastfix",
equal(turn, 2, "Trying toggle with 3 functions, attempt 5 yields 2");
$div.unbind("click", fns[0]);
- var data = jQuery._data($div[0], "events");
+ var data = $._data($div[0], "events");
ok(!data, "Unbinding one function from toggle unbinds them all");
// manually clean up detached elements
@@ -1702,7 +1702,7 @@ steal("jquery/event/fastfix",
div = 0;
livea = 0;
liveb = 0;
- var event = jQuery.Event("click");
+ var event = $.Event("click");
event.button = 1;
jQuery("div#nothiddendiv").trigger(event);
@@ -1742,13 +1742,13 @@ steal("jquery/event/fastfix",
jQuery("#foo").trigger("click", true).die("click");
// Test binding with different this object
- jQuery("#foo").live("click", jQuery.proxy(function (e) {
+ jQuery("#foo").live("click", $.proxy(function (e) {
equal(this.foo, "bar", "live with event scope");
}, { foo : "bar" }));
jQuery("#foo").trigger("click").die("click");
// Test binding with different this object, event data, and trigger data
- jQuery("#foo").live("click", true, jQuery.proxy(function (e, data) {
+ jQuery("#foo").live("click", true, $.proxy(function (e, data) {
equal(e.data, true, "live with with different this object, event data, and trigger data");
equal(this["foo"], "bar", "live with with different this object, event data, and trigger data");
equal(data, true, "live with with different this object, event data, and trigger data");
@@ -2156,7 +2156,7 @@ steal("jquery/event/fastfix",
test("live with special events", function () {
expect(13);
- jQuery.event.special["foo"] = {
+ $.event.special["foo"] = {
setup : function (data, namespaces, handler) {
ok(true, "Setup run.");
},
@@ -2199,7 +2199,7 @@ steal("jquery/event/fastfix",
// Run: remove, teardown
jQuery("#liveSpan1").die("foo");
- delete jQuery.event.special["foo"];
+ delete $.event.special["foo"];
});
test(".delegate()/.undelegate()", function () {
@@ -2315,7 +2315,7 @@ steal("jquery/event/fastfix",
div = 0;
livea = 0;
liveb = 0;
- var event = jQuery.Event("click");
+ var event = $.Event("click");
event.button = 1;
jQuery("div#nothiddendiv").trigger(event);
@@ -2357,14 +2357,14 @@ steal("jquery/event/fastfix",
jQuery("#body").undelegate("#foo", "click");
// Test binding with different this object
- jQuery("#body").delegate("#foo", "click", jQuery.proxy(function (e) {
+ jQuery("#body").delegate("#foo", "click", $.proxy(function (e) {
equal(this["foo"], "bar", "delegate with event scope");
}, { "foo" : "bar" }));
jQuery("#foo").trigger("click");
jQuery("#body").undelegate("#foo", "click");
// Test binding with different this object, event data, and trigger data
- jQuery("#body").delegate("#foo", "click", true, jQuery.proxy(function (e, data) {
+ jQuery("#body").delegate("#foo", "click", true, $.proxy(function (e, data) {
equal(e.data, true, "delegate with with different this object, event data, and trigger data");
equal(this.foo, "bar", "delegate with with different this object, event data, and trigger data");
equal(data, true, "delegate with with different this object, event data, and trigger data");
@@ -2548,7 +2548,7 @@ steal("jquery/event/fastfix",
jQuery("#body").undelegate("#nothiddendiv div", "click");
});
- test("jQuery.off using dispatched jQuery.Event", function () {
+ test("$.off using dispatched $.Event", function () {
expect(1);
var markup = jQuery('
'),
@@ -2811,7 +2811,7 @@ steal("jquery/event/fastfix",
ok(true, "Resize event fired.");
}).resize().unbind("resize");
- ok(!jQuery._data(window, "__events__"), "Make sure all the events are gone.");
+ ok(!$._data(window, "__events__"), "Make sure all the events are gone.");
});
test("focusin bubbles", function () {
@@ -2956,7 +2956,7 @@ steal("jquery/event/fastfix",
.off("click cluck");
// We should have removed all the event handlers ... kinda hacky way to check this
- var data = jQuery.data[ jQuery("#onandoff")[0].expando ] || {};
+ var data = $.data[ jQuery("#onandoff")[0].expando ] || {};
equal(data["events"], undefined, "no events left");
$onandoff.remove();
@@ -2965,7 +2965,7 @@ steal("jquery/event/fastfix",
test("special bind/delegate name mapping", function () {
expect(7);
- jQuery.event.special["slap"] = {
+ $.event.special["slap"] = {
bindType : "click",
delegateType : "swing",
handle : function (event) {
@@ -2978,10 +2978,10 @@ steal("jquery/event/fastfix",
};
jQuery("")
- .on("slap", "button", jQuery.noop)
+ .on("slap", "button", $.noop)
.on("swing", "button", comeback)
.find("button")
- .on("slap", jQuery.noop)
+ .on("slap", $.noop)
.on("click", comeback)
.trigger("click")// bindType-slap and click
.off("slap")
@@ -2996,9 +2996,9 @@ steal("jquery/event/fastfix",
.trigger("swing")
.end()
.remove();
- delete jQuery.event.special["slap"];
+ delete $.event.special["slap"];
- jQuery.event.special["gutfeeling"] = {
+ $.event.special["gutfeeling"] = {
bindType : "click",
delegateType : "click",
handle : function (event) {
@@ -3010,27 +3010,27 @@ steal("jquery/event/fastfix",
// Ensure a special event isn't removed by its mapped type
jQuery('
Gut Feeling
')
- .on("click", jQuery.noop)
- .on("gutfeeling", jQuery.noop)
+ .on("click", $.noop)
+ .on("gutfeeling", $.noop)
.off("click")
.trigger("gutfeeling")
.remove();
// Ensure special events are removed when only a namespace is provided
jQuery('
Gut Feeling
')
- .on("gutfeeling.Devo", jQuery.noop)
+ .on("gutfeeling.Devo", $.noop)
.off(".Devo")
.trigger("gutfeeling")
.remove();
// Ensure .one() events are removed after their maiden voyage
jQuery('
Gut Feeling
')
- .one("gutfeeling", jQuery.noop)
+ .one("gutfeeling", $.noop)
.trigger("gutfeeling")// This one should
.trigger("gutfeeling")// This one should not
.remove();
- delete jQuery.event.special["gutfeeling"];
+ delete $.event.special["gutfeeling"];
});
test(".on and .off, selective mixed removal (#10705)", function () {
@@ -3101,13 +3101,13 @@ steal("jquery/event/fastfix",
order = [],
args = {};
- notYetReady = !jQuery.isReady;
+ notYetReady = !$.isReady;
- test("jQuery.isReady", function () {
+ test("$.isReady", function () {
expect(2);
- equal(notYetReady, true, "jQuery.isReady should not be true before DOM ready");
- equal(jQuery.isReady, true, "jQuery.isReady should be true once DOM is ready");
+ equal(notYetReady, true, "$.isReady should not be true before DOM ready");
+ equal($.isReady, true, "$.isReady should be true once DOM is ready");
});
// Create an event handler.
@@ -3145,7 +3145,7 @@ steal("jquery/event/fastfix",
// Ensure handler argument is correct.
equal(args["a"], jQuery, "Argument passed to fn in jQuery( fn ) should be jQuery");
equal(args["b"], jQuery, "Argument passed to fn in jQuery(document).ready( fn ) should be jQuery");
- ok(args["c"] instanceof jQuery.Event, "Argument passed to fn in jQuery(document).bind( 'ready', fn ) should be an event object");
+ ok(args["c"] instanceof $.Event, "Argument passed to fn in jQuery(document).bind( 'ready', fn ) should be an event object");
order = [];
@@ -3173,7 +3173,7 @@ steal("jquery/event/fastfix",
var $fixture = jQuery("").appendTo("body");
- var originRemoveEvent = jQuery.removeEvent;
+ var originRemoveEvent = $.removeEvent;
var wrapperRemoveEvent = function (elem, type, handle) {
equal("change", type, "Event handler for 'change' event should be removed");
@@ -3181,7 +3181,7 @@ steal("jquery/event/fastfix",
originRemoveEvent(elem, type, handle);
};
- jQuery.removeEvent = wrapperRemoveEvent;
+ $.removeEvent = wrapperRemoveEvent;
$fixture.bind("change", function (event) {
});
@@ -3189,7 +3189,7 @@ steal("jquery/event/fastfix",
$fixture.remove();
- jQuery.removeEvent = originRemoveEvent;
+ $.removeEvent = originRemoveEvent;
});
asyncTest("trigger click on checkbox, fires change event", function () {
diff --git a/event/handle/handle.js b/event/handle/handle.js
index 42961301..4fb8fdc7 100644
--- a/event/handle/handle.js
+++ b/event/handle/handle.js
@@ -27,19 +27,19 @@ $.event.trigger = function(event, data, elem, onlyHandlers){
namespaces.sort();
}
- if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
+ if ( (!elem || $.event.customEvent[ type ]) && !$.event.global[ type ] ) {
// No jQuery handlers for this event type, and it can't have inline handlers
return;
}
// Caller can pass in an Event, Object, or just an event type string
event = typeof event === "object" ?
- // jQuery.Event object
- event[ jQuery.expando ] ? event :
+ // $.Event object
+ event[ $.expando ] ? event :
// Object literal
- new jQuery.Event( type, event ) :
+ new $.Event( type, event ) :
// Just the event type (string)
- new jQuery.Event( type );
+ new $.Event( type );
event.type = type;
event.exclusive = exclusive;
@@ -55,14 +55,14 @@ $.event.trigger = function(event, data, elem, onlyHandlers){
// Handle a global trigger
if ( !elem ) {
// TODO: Stop taunting the data cache; remove global events and always attach to document
- jQuery.each( jQuery.cache, function() {
+ $.each( $.cache, function() {
// internalKey variable is just used to make it easier to find
// and potentially change this stuff later; currently it just
- // points to jQuery.expando
- var internalKey = jQuery.expando,
+ // points to $.expando
+ var internalKey = $.expando,
internalCache = this[ internalKey ];
if ( internalCache && internalCache.events && internalCache.events[ type ] ) {
- jQuery.event.trigger( event, data, internalCache.handle.elem );
+ $.event.trigger( event, data, internalCache.handle.elem );
}
});
return;
@@ -78,7 +78,7 @@ $.event.trigger = function(event, data, elem, onlyHandlers){
event.target = elem;
// Clone any incoming data and prepend the event, creating the handler arg list
- data = data ? jQuery.makeArray( data ) : [];
+ data = data ? $.makeArray( data ) : [];
data.unshift( event );
var cur = elem,
@@ -87,7 +87,7 @@ $.event.trigger = function(event, data, elem, onlyHandlers){
// Fire event on the current element, then bubble up the DOM tree
do {
- var handle = jQuery._data( cur, "handle" );
+ var handle = $._data( cur, "handle" );
event.currentTarget = cur;
if ( handle ) {
@@ -95,7 +95,7 @@ $.event.trigger = function(event, data, elem, onlyHandlers){
}
// Trigger an inline bound script
- if ( ontype && jQuery.acceptData( cur ) && cur[ ontype ] && cur[ ontype ].apply( cur, data ) === false ) {
+ if ( ontype && $.acceptData( cur ) && cur[ ontype ] && cur[ ontype ].apply( cur, data ) === false ) {
event.result = false;
event.preventDefault();
}
@@ -107,10 +107,10 @@ $.event.trigger = function(event, data, elem, onlyHandlers){
// If nobody prevented the default action, do it now
if ( !event.isDefaultPrevented() ) {
var old,
- special = jQuery.event.special[ type ] || {};
+ special = $.event.special[ type ] || {};
if ( (!special._default || special._default.call( elem.ownerDocument, event ) === false) &&
- !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
+ !(type === "click" && $.nodeName( elem, "a" )) && $.acceptData( elem ) ) {
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction)() check here because IE6/7 fails that test.
@@ -124,7 +124,7 @@ $.event.trigger = function(event, data, elem, onlyHandlers){
elem[ ontype ] = null;
}
- jQuery.event.triggered = type;
+ $.event.triggered = type;
elem[ type ]();
}
} catch ( ieError ) {}
@@ -133,7 +133,7 @@ $.event.trigger = function(event, data, elem, onlyHandlers){
elem[ ontype ] = old;
}
- jQuery.event.triggered = undefined;
+ $.event.triggered = undefined;
}
}
@@ -142,9 +142,9 @@ $.event.trigger = function(event, data, elem, onlyHandlers){
// a copy of $'s handle function that goes until it finds
$.event.handle = function( event ) {
- event = jQuery.event.fix( event || window.event );
+ event = $.event.fix( event || window.event );
// Snapshot the handlers list since a called handler may add/remove events.
- var handlers = ((jQuery._data( this, "events" ) || {})[ event.type ] || []).slice(0),
+ var handlers = (($._data( this, "events" ) || {})[ event.type ] || []).slice(0),
run_all = !event.exclusive && !event.namespace,
args = Array.prototype.slice.call( arguments, 0 );
diff --git a/event/key/key.js b/event/key/key.js
index 3f4d6db8..6a908f8d 100644
--- a/event/key/key.js
+++ b/event/key/key.js
@@ -128,7 +128,7 @@ steal('jquery', function($){
*
* @return {String} The string representation of of the key pressed.
*/
- jQuery.Event.prototype.keyName = function(){
+ $.Event.prototype.keyName = function(){
var event = this,
test = /\w/,
// It can be either keyCode or charCode.
diff --git a/event/livehack/livehack.js b/event/livehack/livehack.js
index d1397adc..9038c6de 100644
--- a/event/livehack/livehack.js
+++ b/event/livehack/livehack.js
@@ -1,6 +1,6 @@
steal('jquery', function($) {
- var event = jQuery.event,
+ var event = $.event,
//helper that finds handlers by type and calls back a function, this is basically handle
// events - the events object
diff --git a/event/pause/pause.js b/event/pause/pause.js
index a8b87e7e..947c39e8 100644
--- a/event/pause/pause.js
+++ b/event/pause/pause.js
@@ -56,19 +56,19 @@ $.Event.prototype.resume = function(){
var handleObj = this.handleObj,
currentTarget = this.currentTarget;
// temporarily overwrite special handle
- var origType = jQuery.event.special[ handleObj.origType ],
+ var origType = $.event.special[ handleObj.origType ],
origHandle = origType && origType.handle;
if(!origType){
- jQuery.event.special[ handleObj.origType ] = {};
+ $.event.special[ handleObj.origType ] = {};
}
- jQuery.event.special[ handleObj.origType ].handle = function(ev){
+ $.event.special[ handleObj.origType ].handle = function(ev){
// remove this once we have passed the handleObj
if(ev.handleObj === handleObj && ev.currentTarget === currentTarget){
if(!origType){
- delete jQuery.event.special[ handleObj.origType ];
+ delete $.event.special[ handleObj.origType ];
} else {
- jQuery.event.special[ handleObj.origType ].handle = origHandle;
+ $.event.special[ handleObj.origType ].handle = origHandle;
}
}
}
diff --git a/model/list/list_test.js b/model/list/list_test.js
index 1318fc9e..04ec9bd9 100644
--- a/model/list/list_test.js
+++ b/model/list/list_test.js
@@ -173,7 +173,7 @@ test("events - add", 3, function(){
// events are hooked internally now
// ok( $(person).data("events"), "person has events" );
- ok(jQuery._data(person, 'events'), "person has events" );
+ ok($._data(person, 'events'), "person has events" );
list.pop()
From 0da67f13d148b39b9c198720b6b3696f210d8470 Mon Sep 17 00:00:00 2001
From: David Luecke
Date: Wed, 6 Feb 2013 15:11:31 -0700
Subject: [PATCH 033/105] Refactoring drag event to include plugins by default
---
event/drag/core/core.js | 747 ++++++++++++++++++++++++++++++++++++++
event/drag/drag.js | 746 +------------------------------------
event/drag/limit/limit.js | 2 +-
event/drag/step/step.js | 2 +-
event/drop/drop.js | 2 +-
5 files changed, 751 insertions(+), 748 deletions(-)
create mode 100644 event/drag/core/core.js
diff --git a/event/drag/core/core.js b/event/drag/core/core.js
new file mode 100644
index 00000000..fcd3daf7
--- /dev/null
+++ b/event/drag/core/core.js
@@ -0,0 +1,747 @@
+steal('jquery', 'jquery/lang/vector', 'jquery/event/livehack', 'jquery/event/reverse', function( $ ) {
+
+ if(!$.event.special.move) {
+ $.event.reverse('move');
+ }
+
+ //modify live
+ //steal the live handler ....
+ var bind = function( object, method ) {
+ var args = Array.prototype.slice.call(arguments, 2);
+ return function() {
+ var args2 = [this].concat(args, $.makeArray(arguments));
+ return method.apply(object, args2);
+ };
+ },
+ event = $.event,
+ // function to clear the window selection if there is one
+ clearSelection = window.getSelection ? function(){
+ window.getSelection().removeAllRanges()
+ } : function(){},
+
+ supportTouch = "ontouchend" in document,
+ // Use touch events or map it to mouse events
+ startEvent = supportTouch ? "touchstart" : "mousedown",
+ stopEvent = supportTouch ? "touchend" : "mouseup",
+ moveEvent = supportTouch ? "touchmove" : "mousemove",
+ // On touchmove events the default (scrolling) event has to be prevented
+ preventTouchScroll = function(ev) {
+ ev.preventDefault();
+ };
+
+ /**
+ * @class jQuery.Drag
+ * @parent jQuery.event.drag
+ * @plugin jquery/event/drag
+ * @download http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/event/drag/drag.js
+ * @test jquery/event/drag/qunit.html
+ *
+ * The `$.Drag` constructor is never called directly but an instance of `$.Drag` is passed as the second argument
+ * to the `dragdown`, `draginit`, `dragmove`, `dragend`, `dragover` and `dragout` event handlers:
+ *
+ * $('#dragger').on('draginit', function(el, drag) {
+ * // drag -> $.Drag
+ * });
+ */
+ $.Drag = function() {};
+
+ /**
+ * @Static
+ */
+ $.extend($.Drag, {
+ lowerName: "drag",
+ current: null,
+ distance: 0,
+ /**
+ * Called when someone mouses down on a draggable object.
+ * Gathers all callback functions and creates a new Draggable.
+ * @hide
+ */
+ mousedown: function( ev, element ) {
+ var isLeftButton = ev.button === 0 || ev.button == 1,
+ doEvent = isLeftButton || supportTouch;
+
+ if (!doEvent || this.current ) {
+ return;
+ }
+
+ //create Drag
+ var drag = new $.Drag(),
+ delegate = ev.delegateTarget || element,
+ selector = ev.handleObj.selector,
+ self = this;
+ this.current = drag;
+
+ drag.setup({
+ element: element,
+ delegate: ev.delegateTarget || element,
+ selector: ev.handleObj.selector,
+ moved: false,
+ _distance: this.distance,
+ callbacks: {
+ dragdown: event.find(delegate, ["dragdown"], selector),
+ draginit: event.find(delegate, ["draginit"], selector),
+ dragover: event.find(delegate, ["dragover"], selector),
+ dragmove: event.find(delegate, ["dragmove"], selector),
+ dragout: event.find(delegate, ["dragout"], selector),
+ dragend: event.find(delegate, ["dragend"], selector),
+ dragcleanup: event.find(delegate, ["dragcleanup"], selector)
+ },
+ destroyed: function() {
+ self.current = null;
+ }
+ }, ev);
+ }
+ });
+
+ /**
+ * @Prototype
+ */
+ $.extend($.Drag.prototype, {
+ setup: function( options, ev ) {
+ $.extend(this, options);
+
+ this.element = $(this.element);
+ this.event = ev;
+ this.moved = false;
+ this.allowOtherDrags = false;
+ var mousemove = bind(this, this.mousemove),
+ mouseup = bind(this, this.mouseup);
+ this._mousemove = mousemove;
+ this._mouseup = mouseup;
+ this._distance = options.distance ? options.distance : 0;
+
+ //where the mouse is located
+ this.mouseStartPosition = ev.vector();
+
+ $(document).bind(moveEvent, mousemove);
+ $(document).bind(stopEvent, mouseup);
+ if(supportTouch) {
+ // On touch devices we want to disable scrolling
+ $(document).bind(moveEvent, preventTouchScroll);
+ }
+
+ if (!this.callEvents('down', this.element, ev) ) {
+ this.noSelection(this.delegate);
+ //this is for firefox
+ clearSelection();
+ }
+ },
+ /**
+ * @attribute element
+ * A reference to the element that is being dragged. For example:
+ *
+ * $('.draggable').on('draginit', function(ev, drag) {
+ * drag.element.html('I am the drag element');
+ * });
+ */
+
+ /**
+ * Unbinds listeners and allows other drags ...
+ * @hide
+ */
+ destroy: function() {
+ // Unbind the mouse handlers attached for dragging
+ $(document).unbind(moveEvent, this._mousemove);
+ $(document).unbind(stopEvent, this._mouseup);
+ if(supportTouch) {
+ // Enable scrolling again for touch devices when the drag is done
+ $(document).unbind(moveEvent, preventTouchScroll);
+ }
+
+ if (!this.moved ) {
+ this.event = this.element = null;
+ }
+
+ if(!supportTouch) {
+ this.selection(this.delegate);
+ }
+ this.destroyed();
+ },
+ mousemove: function( docEl, ev ) {
+ if (!this.moved ) {
+ var dist = Math.sqrt( Math.pow( ev.pageX - this.event.pageX, 2 ) + Math.pow( ev.pageY - this.event.pageY, 2 ));
+ // Don't initialize the drag if it hasn't been moved the minimum distance
+ if(dist < this._distance){
+ return false;
+ }
+ // Otherwise call init and indicate that the drag has moved
+ this.init(this.element, ev);
+ this.moved = true;
+ }
+
+ this.element.trigger('move', this);
+ var pointer = ev.vector();
+ if ( this._start_position && this._start_position.equals(pointer) ) {
+ return;
+ }
+ this.draw(pointer, ev);
+ },
+
+ mouseup: function( docEl, event ) {
+ //if there is a current, we should call its dragstop
+ if ( this.moved ) {
+ this.end(event);
+ }
+ this.destroy();
+ },
+
+ /**
+ * The `drag.noSelection(element)` method turns off text selection during a drag event.
+ * This method is called by default unless a event is listening to the 'dragdown' event.
+ *
+ * ## Example
+ *
+ * $('div.drag').bind('dragdown', function(elm,event,drag){
+ * drag.noSelection();
+ * });
+ *
+ * @param [elm] an element to prevent selection on. Defaults to the dragable element.
+ */
+ noSelection: function(elm) {
+ elm = elm || this.delegate
+ document.documentElement.onselectstart = function() {
+ // Disables selection
+ return false;
+ };
+ document.documentElement.unselectable = "on";
+ this.selectionDisabled = (this.selectionDisabled ? this.selectionDisabled.add(elm) : $(elm));
+ this.selectionDisabled.css('-moz-user-select', '-moz-none');
+ },
+
+ /**
+ * @hide
+ * `drag.selection()` method turns on text selection that was previously turned off during the drag event.
+ * This method is always called.
+ *
+ * ## Example
+ *
+ * $('div.drag').bind('dragdown', function(elm,event,drag){
+ * drag.selection();
+ * });
+ */
+ selection: function() {
+ if(this.selectionDisabled) {
+ document.documentElement.onselectstart = function() {};
+ document.documentElement.unselectable = "off";
+ this.selectionDisabled.css('-moz-user-select', '');
+ }
+ },
+
+ init: function( element, event ) {
+ element = $(element);
+ //the element that has been clicked on
+ var startElement = (this.movingElement = (this.element = $(element)));
+ //if a mousemove has come after the click
+ //if the drag has been cancelled
+ this._cancelled = false;
+ this.event = event;
+
+ /**
+ * @attribute mouseElementPosition
+ * The position of start of the cursor on the element
+ */
+ this.mouseElementPosition = this.mouseStartPosition.minus(this.element.offsetv()); //where the mouse is on the Element
+ this.callEvents('init', element, event);
+
+ // Check what they have set and respond accordingly if they canceled
+ if ( this._cancelled === true ) {
+ return;
+ }
+ // if they set something else as the element
+ this.startPosition = startElement != this.movingElement ? this.movingElement.offsetv() : this.currentDelta();
+
+ this.makePositioned(this.movingElement);
+ // Adjust the drag elements z-index to a high value
+ this.oldZIndex = this.movingElement.css('zIndex');
+ this.movingElement.css('zIndex', 1000);
+ if (!this._only && this.constructor.responder ) {
+ // calls $.Drop.prototype.compile if there is a drop element
+ this.constructor.responder.compile(event, this);
+ }
+ },
+ makePositioned: function( that ) {
+ var style, pos = that.css('position');
+
+ // Position properly, set top and left to 0px for Opera
+ if (!pos || pos == 'static' ) {
+ style = {
+ position: 'relative'
+ };
+
+ if ( window.opera ) {
+ style.top = '0px';
+ style.left = '0px';
+ }
+ that.css(style);
+ }
+ },
+ callEvents: function( type, element, event, drop ) {
+ var i, cbs = this.callbacks[this.constructor.lowerName + type];
+ for ( i = 0; i < cbs.length; i++ ) {
+ cbs[i].call(element, event, this, drop);
+ }
+ return cbs.length;
+ },
+ /**
+ * Returns the position of the movingElement by taking its top and left.
+ * @hide
+ * @return {$.Vector}
+ */
+ currentDelta: function() {
+ return new $.Vector(parseInt(this.movingElement.css('left'), 10) || 0, parseInt(this.movingElement.css('top'), 10) || 0);
+ },
+ //draws the position of the dragmove object
+ draw: function( pointer, event ) {
+ // only drag if we haven't been cancelled;
+ if ( this._cancelled ) {
+ return;
+ }
+ clearSelection();
+ /**
+ * @attribute location
+ * `drag.location` is a [jQuery.Vector] specifying where the element should be in the page. This
+ * takes into account the start position of the cursor on the element.
+ *
+ * If the drag is going to be moved to an unacceptable location, you can call preventDefault in
+ * dragmove to prevent it from being moved there.
+ *
+ * $('.mover').bind("dragmove", function(ev, drag){
+ * if(drag.location.top() < 100){
+ * ev.preventDefault()
+ * }
+ * });
+ *
+ * You can also set the location to where it should be on the page.
+ *
+ */
+ // the offset between the mouse pointer and the representative that the user asked for
+ this.location = pointer.minus(this.mouseElementPosition);
+
+ // call move events
+ this.move(event);
+ if ( this._cancelled ) {
+ return;
+ }
+ if (!event.isDefaultPrevented() ) {
+ this.position(this.location);
+ }
+
+ // fill in
+ if (!this._only && this.constructor.responder ) {
+ this.constructor.responder.show(pointer, this, event);
+ }
+ },
+ /**
+ * `drag.position( newOffsetVector )` sets the position of the movingElement. This is overwritten by
+ * the [$.Drag::scrolls], [$.Drag::limit] and [$.Drag::step] plugins
+ * to make sure the moving element scrolls some element
+ * or stays within some boundary. This function is exposed and documented so you could do the same.
+ *
+ * The following approximates how step does it:
+ *
+ * var oldPosition = $.Drag.prototype.position;
+ * $.Drag.prototype.position = function( offsetPositionv ) {
+ * if(this._step){
+ * // change offsetPositionv to be on the step value
+ * }
+ *
+ * oldPosition.call(this, offsetPosition)
+ * }
+ *
+ * @param {jQuery.Vector} newOffsetv the new [$.Drag::location] of the element.
+ */
+ position: function( newOffsetv ) { //should draw it on the page
+ var style, dragged_element_css_offset = this.currentDelta(),
+ // the drag element's current left + top css attributes
+ // the vector between the movingElement's page and css positions
+ // this can be thought of as the original offset
+ dragged_element_position_vector = this.movingElement.offsetv().minus(dragged_element_css_offset);
+ this.required_css_position = newOffsetv.minus(dragged_element_position_vector);
+
+ this.offsetv = newOffsetv;
+ style = this.movingElement[0].style;
+ if (!this._cancelled && !this._horizontal ) {
+ style.top = this.required_css_position.top() + "px";
+ }
+ if (!this._cancelled && !this._vertical ) {
+ style.left = this.required_css_position.left() + "px";
+ }
+ },
+ move: function( event ) {
+ this.callEvents('move', this.element, event);
+ },
+ over: function( event, drop ) {
+ this.callEvents('over', this.element, event, drop);
+ },
+ out: function( event, drop ) {
+ this.callEvents('out', this.element, event, drop);
+ },
+ /**
+ * Called on drag up
+ * @hide
+ * @param {Event} event a mouseup event signalling drag/drop has completed
+ */
+ end: function( event ) {
+ // If canceled do nothing
+ if ( this._cancelled ) {
+ return;
+ }
+ // notify the responder - usually a $.Drop instance
+ if (!this._only && this.constructor.responder ) {
+ this.constructor.responder.end(event, this);
+ }
+
+ this.callEvents('end', this.element, event);
+
+ if ( this._revert ) {
+ var self = this;
+ // animate moving back to original position
+ this.movingElement.animate({
+ top: this.startPosition.top() + "px",
+ left: this.startPosition.left() + "px"
+ }, function() {
+ self.cleanup.apply(self, arguments);
+ });
+ }
+ else {
+ this.cleanup(event);
+ }
+ this.event = null;
+ },
+ /**
+ * Cleans up drag element after drag drop.
+ * @hide
+ */
+ cleanup: function(event) {
+ this.movingElement.css({
+ zIndex: this.oldZIndex
+ });
+ if ( this.movingElement[0] !== this.element[0] &&
+ !this.movingElement.has(this.element[0]).length &&
+ !this.element.has(this.movingElement[0]).length ) {
+ this.movingElement.css({
+ display: 'none'
+ });
+ }
+ if ( this._removeMovingElement ) {
+ // Remove the element when using drag.ghost()
+ this.movingElement.remove();
+ }
+
+ if(event) {
+ this.callEvents('cleanup', this.element, event);
+ }
+
+ this.movingElement = this.element = this.event = null;
+ },
+ /**
+ * `drag.cancel()` stops a drag motion from from running. This also stops any other events from firing, meaning
+ * that "dragend" will not be called.
+ *
+ * $("#todos").on(".handle", "draginit", function( ev, drag ) {
+ * if(drag.movingElement.hasClass("evil")){
+ * drag.cancel();
+ * }
+ * })
+ *
+ */
+ cancel: function() {
+ this._cancelled = true;
+ if (!this._only && this.constructor.responder ) {
+ // clear the drops
+ this.constructor.responder.clear(this.event.vector(), this, this.event);
+ }
+ this.destroy();
+
+ },
+ /**
+ * `drag.ghost( [parent] )` clones the element and uses it as the
+ * moving element, leaving the original dragged element in place. The `parent` option can
+ * be used to specify where the ghost element should be temporarily added into the
+ * DOM. This method should be called in "draginit".
+ *
+ * $("#todos").on(".handle", "draginit", function( ev, drag ) {
+ * drag.ghost();
+ * })
+ *
+ * @param {HTMLElement} [parent] the parent element of the newly created ghost element. If not provided the
+ * ghost element is added after the moving element.
+ * @return {jQuery.fn} the ghost element to do whatever you want with it.
+ */
+ ghost: function( parent ) {
+ // create a ghost by cloning the source element and attach the clone to the dom after the source element
+ var ghost = this.movingElement.clone().css('position', 'absolute');
+ if( parent ) {
+ $(parent).append(ghost);
+ } else {
+ $(this.movingElement).after(ghost)
+ }
+ ghost.width(this.movingElement.width()).height(this.movingElement.height());
+ // put the ghost in the right location ...
+ ghost.offset(this.movingElement.offset())
+
+ // store the original element and make the ghost the dragged element
+ this.movingElement = ghost;
+ this.noSelection(ghost)
+ this._removeMovingElement = true;
+ return ghost;
+ },
+ /**
+ * `drag.representative( element, [offsetX], [offsetY])` tells the drag motion to use
+ * a different element than the one that began the drag motion.
+ *
+ * For example, instead of
+ * dragging an drag-icon of a todo element, you want to move some other representation of
+ * the todo element (or elements). To do this you might:
+ *
+ * $("#todos").on(".handle", "draginit", function( ev, drag ) {
+ * // create what we'll drag
+ * var rep = $('').text("todos")
+ * .appendTo(document.body)
+ * // indicate we want our mouse on the top-right of it
+ * drag.representative(rep, rep.width(), 0);
+ * })
+ *
+ * @param {HTMLElement} element the element you want to actually drag. This should be
+ * already in the DOM.
+ * @param {Number} offsetX the x position where you want your mouse on the representative element (defaults to 0)
+ * @param {Number} offsetY the y position where you want your mouse on the representative element (defaults to 0)
+ * @return {drag} returns the drag object for chaining.
+ */
+ representative: function( element, offsetX, offsetY ) {
+ this._offsetX = offsetX || 0;
+ this._offsetY = offsetY || 0;
+
+ var p = this.mouseStartPosition;
+ // Just set the representative as the drag element
+ this.movingElement = $(element);
+ this.movingElement.css({
+ top: (p.y() - this._offsetY) + "px",
+ left: (p.x() - this._offsetX) + "px",
+ display: 'block',
+ position: 'absolute'
+ }).show();
+ this.noSelection(this.movingElement)
+ this.mouseElementPosition = new $.Vector(this._offsetX, this._offsetY);
+ return this;
+ },
+ /**
+ * `drag.revert([val])` makes the [$.Drag::representative representative] element revert back to it
+ * original position after the drag motion has completed. The revert is done with an animation.
+ *
+ * $("#todos").on(".handle","dragend",function( ev, drag ) {
+ * drag.revert();
+ * })
+ *
+ * @param {Boolean} [val] optional, set to false if you don't want to revert.
+ * @return {drag} the drag object for chaining
+ */
+ revert: function( val ) {
+ this._revert = val === undefined ? true : val;
+ return this;
+ },
+ /**
+ * `drag.vertical()` isolates the drag to vertical movement. For example:
+ *
+ * $("#images").on(".thumbnail","draginit", function(ev, drag){
+ * drag.vertical();
+ * });
+ *
+ * Call `vertical()` in "draginit" or "dragdown".
+ *
+ * @return {drag} the drag object for chaining.
+ */
+ vertical: function() {
+ this._vertical = true;
+ return this;
+ },
+ /**
+ * `drag.horizontal()` isolates the drag to horizontal movement. For example:
+ *
+ * $("#images").on(".thumbnail","draginit", function(ev, drag){
+ * drag.horizontal();
+ * });
+ *
+ * Call `horizontal()` in "draginit" or "dragdown".
+ *
+ * @return {drag} the drag object for chaining.
+ */
+ horizontal: function() {
+ this._horizontal = true;
+ return this;
+ },
+ /**
+ * `drag.only([only])` indicates if you __only__ want a drag motion and the drag should
+ * not notify drops. The default value is `false`. Call it with no arguments or pass it true
+ * to prevent drop events.
+ *
+ * $("#images").on(".thumbnail","dragdown", function(ev, drag){
+ * drag.only();
+ * });
+ *
+ * @param {Boolean} [only] true if you want to prevent drops, false if otherwise.
+ * @return {Boolean} the current value of only.
+ */
+ only: function( only ) {
+ return (this._only = (only === undefined ? true : only));
+ },
+
+ /**
+ * `distance([val])` sets or reads the distance the mouse must move before a drag motion is started. This should be set in
+ * "dragdown" and delays "draginit" being called until the distance is covered. The distance
+ * is measured in pixels. The default distance is 0 pixels meaning the drag motion starts on the first
+ * mousemove after a mousedown.
+ *
+ * Set this to make drag motion a little "stickier" to start.
+ *
+ * $("#images").on(".thumbnail","dragdown", function(ev, drag){
+ * drag.distance(10);
+ * });
+ *
+ * @param {Number} [val] The number of pixels the mouse must move before "draginit" is called.
+ * @return {drag|Number} returns the drag instance for chaining if the drag value is being set or the
+ * distance value if the distance is being read.
+ */
+ distance: function(val){
+ if(val !== undefined){
+ this._distance = val;
+ return this;
+ }else{
+ return this._distance
+ }
+ }
+ });
+ /**
+ * @add jQuery.event.special
+ */
+ event.setupHelper([
+ /**
+ * @attribute dragdown
+ * @parent jQuery.event.drag
+ *
+ * `dragdown` is called when a drag movement has started on a mousedown.
+ * The event handler gets an instance of [jQuery.Drag] passed as the second
+ * parameter. Listening to `dragdown` allows you to customize
+ * the behavior of a drag motion, especially when `draginit` should be called.
+ *
+ * $(".handles").delegate("dragdown", function(ev, drag){
+ * // call draginit only when the mouse has moved 20 px
+ * drag.distance(20);
+ * })
+ *
+ * Typically, when a drag motion is started, `event.preventDefault` is automatically
+ * called, preventing text selection. However, if you listen to
+ * `dragdown`, this default behavior is not called. You are responsible for calling it
+ * if you want it (you probably do).
+ *
+ * ### Why might you not want to call `preventDefault`?
+ *
+ * You might want it if you want to allow text selection on element
+ * within the drag element. Typically these are input elements.
+ *
+ * $(".handles").delegate("dragdown", function(ev, drag){
+ * if(ev.target.nodeName === "input"){
+ * drag.cancel();
+ * } else {
+ * ev.preventDefault();
+ * }
+ * })
+ */
+ 'dragdown',
+ /**
+ * @attribute draginit
+ * @parent jQuery.event.drag
+ *
+ * `draginit` is triggered when the drag motion starts. Use it to customize the drag behavior
+ * using the [jQuery.Drag] instance passed as the second parameter:
+ *
+ * $(".draggable").on('draginit', function(ev, drag) {
+ * // Only allow vertical drags
+ * drag.vertical();
+ * // Create a draggable copy of the element
+ * drag.ghost();
+ * });
+ */
+ 'draginit',
+ /**
+ * @attribute dragover
+ * @parent jQuery.event.drag
+ *
+ * `dragover` is triggered when a drag is over a [jQuery.event.drop drop element].
+ * The event handler gets an instance of [jQuery.Drag] passed as the second
+ * parameter and an instance of [jQuery.Drop] passed as the third argument:
+ *
+ * $('.draggable').on('dragover', function(ev, drag, drop) {
+ * // Add the drop-here class indicating that the drag
+ * // can be dropped here
+ * drag.element.addClass('drop-here');
+ * });
+ */
+ 'dragover',
+ /**
+ * @attribute dragmove
+ * @parent jQuery.event.drag
+ *
+ * `dragmove` is triggered when the drag element moves (similar to a mousemove).
+ * The event handler gets an instance of [jQuery.Drag] passed as the second
+ * parameter.
+ * Use [jQuery.Drag::location] to determine the current position
+ * as a [jQuery.Vector vector].
+ *
+ * For example, `dragmove` can be used to create a draggable element to resize
+ * a container:
+ *
+ * $('.resizer').on('dragmove', function(ev, drag) {
+ * $('#container').width(drag.location.x())
+ * .height(drag.location.y());
+ * });
+ */
+ 'dragmove',
+ /**
+ * @attribute dragout
+ * @parent jQuery.event.drag
+ *
+ * `dragout` is called when the drag leaves a drop point.
+ * The event handler gets an instance of [jQuery.Drag] passed as the second
+ * parameter.
+ *
+ * $('.draggable').on('dragout', function(ev, drag) {
+ * // Remove the drop-here class
+ * // (e.g. crossing the drag element out indicating that it
+ * // can't be dropped here
+ * drag.element.removeClass('drop-here');
+ * });
+ */
+ 'dragout',
+ /**
+ * @attribute dragend
+ * @parent jQuery.event.drag
+ *
+ * `dragend` is called when the drag operation is completed.
+ * The event handler gets an instance of [jQuery.Drag] passed as the second
+ * parameter.
+ *
+ * $('.draggable').on('dragend', function(ev, drag)
+ * // Calculation on whether revert should be invoked, alterations based on position of the end event
+ * });
+ */
+ 'dragend',
+ /**
+ * @attribute dragcleanup
+ * @parent jQuery.event.drag
+ *
+ * `dragcleanup` is called after dragend and revert (if applied)
+ * The event handler gets an instance of [jQuery.Drag] passed as the second
+ * parameter.
+ *
+ * $('.draggable').on('dragcleanup', function(ev, drag)
+ * // cleanup
+ * });
+ */
+ 'dragcleanup'], startEvent, function( e ) {
+ $.Drag.mousedown.call($.Drag, e, this);
+ });
+
+ return $;
+});
\ No newline at end of file
diff --git a/event/drag/drag.js b/event/drag/drag.js
index 771a17aa..1f44aa91 100644
--- a/event/drag/drag.js
+++ b/event/drag/drag.js
@@ -1,747 +1,3 @@
-steal('jquery', 'jquery/lang/vector', 'jquery/event/livehack', 'jquery/event/reverse', function( $ ) {
-
- if(!$.event.special.move) {
- $.event.reverse('move');
- }
-
- //modify live
- //steal the live handler ....
- var bind = function( object, method ) {
- var args = Array.prototype.slice.call(arguments, 2);
- return function() {
- var args2 = [this].concat(args, $.makeArray(arguments));
- return method.apply(object, args2);
- };
- },
- event = $.event,
- // function to clear the window selection if there is one
- clearSelection = window.getSelection ? function(){
- window.getSelection().removeAllRanges()
- } : function(){},
-
- supportTouch = "ontouchend" in document,
- // Use touch events or map it to mouse events
- startEvent = supportTouch ? "touchstart" : "mousedown",
- stopEvent = supportTouch ? "touchend" : "mouseup",
- moveEvent = supportTouch ? "touchmove" : "mousemove",
- // On touchmove events the default (scrolling) event has to be prevented
- preventTouchScroll = function(ev) {
- ev.preventDefault();
- };
-
- /**
- * @class jQuery.Drag
- * @parent jQuery.event.drag
- * @plugin jquery/event/drag
- * @download http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/event/drag/drag.js
- * @test jquery/event/drag/qunit.html
- *
- * The `$.Drag` constructor is never called directly but an instance of `$.Drag` is passed as the second argument
- * to the `dragdown`, `draginit`, `dragmove`, `dragend`, `dragover` and `dragout` event handlers:
- *
- * $('#dragger').on('draginit', function(el, drag) {
- * // drag -> $.Drag
- * });
- */
- $.Drag = function() {};
-
- /**
- * @Static
- */
- $.extend($.Drag, {
- lowerName: "drag",
- current: null,
- distance: 0,
- /**
- * Called when someone mouses down on a draggable object.
- * Gathers all callback functions and creates a new Draggable.
- * @hide
- */
- mousedown: function( ev, element ) {
- var isLeftButton = ev.button === 0 || ev.button == 1,
- doEvent = isLeftButton || supportTouch;
-
- if (!doEvent || this.current ) {
- return;
- }
-
- //create Drag
- var drag = new $.Drag(),
- delegate = ev.delegateTarget || element,
- selector = ev.handleObj.selector,
- self = this;
- this.current = drag;
-
- drag.setup({
- element: element,
- delegate: ev.delegateTarget || element,
- selector: ev.handleObj.selector,
- moved: false,
- _distance: this.distance,
- callbacks: {
- dragdown: event.find(delegate, ["dragdown"], selector),
- draginit: event.find(delegate, ["draginit"], selector),
- dragover: event.find(delegate, ["dragover"], selector),
- dragmove: event.find(delegate, ["dragmove"], selector),
- dragout: event.find(delegate, ["dragout"], selector),
- dragend: event.find(delegate, ["dragend"], selector),
- dragcleanup: event.find(delegate, ["dragcleanup"], selector)
- },
- destroyed: function() {
- self.current = null;
- }
- }, ev);
- }
- });
-
- /**
- * @Prototype
- */
- $.extend($.Drag.prototype, {
- setup: function( options, ev ) {
- $.extend(this, options);
-
- this.element = $(this.element);
- this.event = ev;
- this.moved = false;
- this.allowOtherDrags = false;
- var mousemove = bind(this, this.mousemove),
- mouseup = bind(this, this.mouseup);
- this._mousemove = mousemove;
- this._mouseup = mouseup;
- this._distance = options.distance ? options.distance : 0;
-
- //where the mouse is located
- this.mouseStartPosition = ev.vector();
-
- $(document).bind(moveEvent, mousemove);
- $(document).bind(stopEvent, mouseup);
- if(supportTouch) {
- // On touch devices we want to disable scrolling
- $(document).bind(moveEvent, preventTouchScroll);
- }
-
- if (!this.callEvents('down', this.element, ev) ) {
- this.noSelection(this.delegate);
- //this is for firefox
- clearSelection();
- }
- },
- /**
- * @attribute element
- * A reference to the element that is being dragged. For example:
- *
- * $('.draggable').on('draginit', function(ev, drag) {
- * drag.element.html('I am the drag element');
- * });
- */
-
- /**
- * Unbinds listeners and allows other drags ...
- * @hide
- */
- destroy: function() {
- // Unbind the mouse handlers attached for dragging
- $(document).unbind(moveEvent, this._mousemove);
- $(document).unbind(stopEvent, this._mouseup);
- if(supportTouch) {
- // Enable scrolling again for touch devices when the drag is done
- $(document).unbind(moveEvent, preventTouchScroll);
- }
-
- if (!this.moved ) {
- this.event = this.element = null;
- }
-
- if(!supportTouch) {
- this.selection(this.delegate);
- }
- this.destroyed();
- },
- mousemove: function( docEl, ev ) {
- if (!this.moved ) {
- var dist = Math.sqrt( Math.pow( ev.pageX - this.event.pageX, 2 ) + Math.pow( ev.pageY - this.event.pageY, 2 ));
- // Don't initialize the drag if it hasn't been moved the minimum distance
- if(dist < this._distance){
- return false;
- }
- // Otherwise call init and indicate that the drag has moved
- this.init(this.element, ev);
- this.moved = true;
- }
-
- this.element.trigger('move', this);
- var pointer = ev.vector();
- if ( this._start_position && this._start_position.equals(pointer) ) {
- return;
- }
- this.draw(pointer, ev);
- },
-
- mouseup: function( docEl, event ) {
- //if there is a current, we should call its dragstop
- if ( this.moved ) {
- this.end(event);
- }
- this.destroy();
- },
-
- /**
- * The `drag.noSelection(element)` method turns off text selection during a drag event.
- * This method is called by default unless a event is listening to the 'dragdown' event.
- *
- * ## Example
- *
- * $('div.drag').bind('dragdown', function(elm,event,drag){
- * drag.noSelection();
- * });
- *
- * @param [elm] an element to prevent selection on. Defaults to the dragable element.
- */
- noSelection: function(elm) {
- elm = elm || this.delegate
- document.documentElement.onselectstart = function() {
- // Disables selection
- return false;
- };
- document.documentElement.unselectable = "on";
- this.selectionDisabled = (this.selectionDisabled ? this.selectionDisabled.add(elm) : $(elm));
- this.selectionDisabled.css('-moz-user-select', '-moz-none');
- },
-
- /**
- * @hide
- * `drag.selection()` method turns on text selection that was previously turned off during the drag event.
- * This method is always called.
- *
- * ## Example
- *
- * $('div.drag').bind('dragdown', function(elm,event,drag){
- * drag.selection();
- * });
- */
- selection: function() {
- if(this.selectionDisabled) {
- document.documentElement.onselectstart = function() {};
- document.documentElement.unselectable = "off";
- this.selectionDisabled.css('-moz-user-select', '');
- }
- },
-
- init: function( element, event ) {
- element = $(element);
- //the element that has been clicked on
- var startElement = (this.movingElement = (this.element = $(element)));
- //if a mousemove has come after the click
- //if the drag has been cancelled
- this._cancelled = false;
- this.event = event;
-
- /**
- * @attribute mouseElementPosition
- * The position of start of the cursor on the element
- */
- this.mouseElementPosition = this.mouseStartPosition.minus(this.element.offsetv()); //where the mouse is on the Element
- this.callEvents('init', element, event);
-
- // Check what they have set and respond accordingly if they canceled
- if ( this._cancelled === true ) {
- return;
- }
- // if they set something else as the element
- this.startPosition = startElement != this.movingElement ? this.movingElement.offsetv() : this.currentDelta();
-
- this.makePositioned(this.movingElement);
- // Adjust the drag elements z-index to a high value
- this.oldZIndex = this.movingElement.css('zIndex');
- this.movingElement.css('zIndex', 1000);
- if (!this._only && this.constructor.responder ) {
- // calls $.Drop.prototype.compile if there is a drop element
- this.constructor.responder.compile(event, this);
- }
- },
- makePositioned: function( that ) {
- var style, pos = that.css('position');
-
- // Position properly, set top and left to 0px for Opera
- if (!pos || pos == 'static' ) {
- style = {
- position: 'relative'
- };
-
- if ( window.opera ) {
- style.top = '0px';
- style.left = '0px';
- }
- that.css(style);
- }
- },
- callEvents: function( type, element, event, drop ) {
- var i, cbs = this.callbacks[this.constructor.lowerName + type];
- for ( i = 0; i < cbs.length; i++ ) {
- cbs[i].call(element, event, this, drop);
- }
- return cbs.length;
- },
- /**
- * Returns the position of the movingElement by taking its top and left.
- * @hide
- * @return {$.Vector}
- */
- currentDelta: function() {
- return new $.Vector(parseInt(this.movingElement.css('left'), 10) || 0, parseInt(this.movingElement.css('top'), 10) || 0);
- },
- //draws the position of the dragmove object
- draw: function( pointer, event ) {
- // only drag if we haven't been cancelled;
- if ( this._cancelled ) {
- return;
- }
- clearSelection();
- /**
- * @attribute location
- * `drag.location` is a [jQuery.Vector] specifying where the element should be in the page. This
- * takes into account the start position of the cursor on the element.
- *
- * If the drag is going to be moved to an unacceptable location, you can call preventDefault in
- * dragmove to prevent it from being moved there.
- *
- * $('.mover').bind("dragmove", function(ev, drag){
- * if(drag.location.top() < 100){
- * ev.preventDefault()
- * }
- * });
- *
- * You can also set the location to where it should be on the page.
- *
- */
- // the offset between the mouse pointer and the representative that the user asked for
- this.location = pointer.minus(this.mouseElementPosition);
-
- // call move events
- this.move(event);
- if ( this._cancelled ) {
- return;
- }
- if (!event.isDefaultPrevented() ) {
- this.position(this.location);
- }
-
- // fill in
- if (!this._only && this.constructor.responder ) {
- this.constructor.responder.show(pointer, this, event);
- }
- },
- /**
- * `drag.position( newOffsetVector )` sets the position of the movingElement. This is overwritten by
- * the [$.Drag::scrolls], [$.Drag::limit] and [$.Drag::step] plugins
- * to make sure the moving element scrolls some element
- * or stays within some boundary. This function is exposed and documented so you could do the same.
- *
- * The following approximates how step does it:
- *
- * var oldPosition = $.Drag.prototype.position;
- * $.Drag.prototype.position = function( offsetPositionv ) {
- * if(this._step){
- * // change offsetPositionv to be on the step value
- * }
- *
- * oldPosition.call(this, offsetPosition)
- * }
- *
- * @param {jQuery.Vector} newOffsetv the new [$.Drag::location] of the element.
- */
- position: function( newOffsetv ) { //should draw it on the page
- var style, dragged_element_css_offset = this.currentDelta(),
- // the drag element's current left + top css attributes
- // the vector between the movingElement's page and css positions
- // this can be thought of as the original offset
- dragged_element_position_vector = this.movingElement.offsetv().minus(dragged_element_css_offset);
- this.required_css_position = newOffsetv.minus(dragged_element_position_vector);
-
- this.offsetv = newOffsetv;
- style = this.movingElement[0].style;
- if (!this._cancelled && !this._horizontal ) {
- style.top = this.required_css_position.top() + "px";
- }
- if (!this._cancelled && !this._vertical ) {
- style.left = this.required_css_position.left() + "px";
- }
- },
- move: function( event ) {
- this.callEvents('move', this.element, event);
- },
- over: function( event, drop ) {
- this.callEvents('over', this.element, event, drop);
- },
- out: function( event, drop ) {
- this.callEvents('out', this.element, event, drop);
- },
- /**
- * Called on drag up
- * @hide
- * @param {Event} event a mouseup event signalling drag/drop has completed
- */
- end: function( event ) {
- // If canceled do nothing
- if ( this._cancelled ) {
- return;
- }
- // notify the responder - usually a $.Drop instance
- if (!this._only && this.constructor.responder ) {
- this.constructor.responder.end(event, this);
- }
-
- this.callEvents('end', this.element, event);
-
- if ( this._revert ) {
- var self = this;
- // animate moving back to original position
- this.movingElement.animate({
- top: this.startPosition.top() + "px",
- left: this.startPosition.left() + "px"
- }, function() {
- self.cleanup.apply(self, arguments);
- });
- }
- else {
- this.cleanup(event);
- }
- this.event = null;
- },
- /**
- * Cleans up drag element after drag drop.
- * @hide
- */
- cleanup: function(event) {
- this.movingElement.css({
- zIndex: this.oldZIndex
- });
- if ( this.movingElement[0] !== this.element[0] &&
- !this.movingElement.has(this.element[0]).length &&
- !this.element.has(this.movingElement[0]).length ) {
- this.movingElement.css({
- display: 'none'
- });
- }
- if ( this._removeMovingElement ) {
- // Remove the element when using drag.ghost()
- this.movingElement.remove();
- }
-
- if(event) {
- this.callEvents('cleanup', this.element, event);
- }
-
- this.movingElement = this.element = this.event = null;
- },
- /**
- * `drag.cancel()` stops a drag motion from from running. This also stops any other events from firing, meaning
- * that "dragend" will not be called.
- *
- * $("#todos").on(".handle", "draginit", function( ev, drag ) {
- * if(drag.movingElement.hasClass("evil")){
- * drag.cancel();
- * }
- * })
- *
- */
- cancel: function() {
- this._cancelled = true;
- if (!this._only && this.constructor.responder ) {
- // clear the drops
- this.constructor.responder.clear(this.event.vector(), this, this.event);
- }
- this.destroy();
-
- },
- /**
- * `drag.ghost( [parent] )` clones the element and uses it as the
- * moving element, leaving the original dragged element in place. The `parent` option can
- * be used to specify where the ghost element should be temporarily added into the
- * DOM. This method should be called in "draginit".
- *
- * $("#todos").on(".handle", "draginit", function( ev, drag ) {
- * drag.ghost();
- * })
- *
- * @param {HTMLElement} [parent] the parent element of the newly created ghost element. If not provided the
- * ghost element is added after the moving element.
- * @return {jQuery.fn} the ghost element to do whatever you want with it.
- */
- ghost: function( parent ) {
- // create a ghost by cloning the source element and attach the clone to the dom after the source element
- var ghost = this.movingElement.clone().css('position', 'absolute');
- if( parent ) {
- $(parent).append(ghost);
- } else {
- $(this.movingElement).after(ghost)
- }
- ghost.width(this.movingElement.width()).height(this.movingElement.height());
- // put the ghost in the right location ...
- ghost.offset(this.movingElement.offset())
-
- // store the original element and make the ghost the dragged element
- this.movingElement = ghost;
- this.noSelection(ghost)
- this._removeMovingElement = true;
- return ghost;
- },
- /**
- * `drag.representative( element, [offsetX], [offsetY])` tells the drag motion to use
- * a different element than the one that began the drag motion.
- *
- * For example, instead of
- * dragging an drag-icon of a todo element, you want to move some other representation of
- * the todo element (or elements). To do this you might:
- *
- * $("#todos").on(".handle", "draginit", function( ev, drag ) {
- * // create what we'll drag
- * var rep = $('').text("todos")
- * .appendTo(document.body)
- * // indicate we want our mouse on the top-right of it
- * drag.representative(rep, rep.width(), 0);
- * })
- *
- * @param {HTMLElement} element the element you want to actually drag. This should be
- * already in the DOM.
- * @param {Number} offsetX the x position where you want your mouse on the representative element (defaults to 0)
- * @param {Number} offsetY the y position where you want your mouse on the representative element (defaults to 0)
- * @return {drag} returns the drag object for chaining.
- */
- representative: function( element, offsetX, offsetY ) {
- this._offsetX = offsetX || 0;
- this._offsetY = offsetY || 0;
-
- var p = this.mouseStartPosition;
- // Just set the representative as the drag element
- this.movingElement = $(element);
- this.movingElement.css({
- top: (p.y() - this._offsetY) + "px",
- left: (p.x() - this._offsetX) + "px",
- display: 'block',
- position: 'absolute'
- }).show();
- this.noSelection(this.movingElement)
- this.mouseElementPosition = new $.Vector(this._offsetX, this._offsetY);
- return this;
- },
- /**
- * `drag.revert([val])` makes the [$.Drag::representative representative] element revert back to it
- * original position after the drag motion has completed. The revert is done with an animation.
- *
- * $("#todos").on(".handle","dragend",function( ev, drag ) {
- * drag.revert();
- * })
- *
- * @param {Boolean} [val] optional, set to false if you don't want to revert.
- * @return {drag} the drag object for chaining
- */
- revert: function( val ) {
- this._revert = val === undefined ? true : val;
- return this;
- },
- /**
- * `drag.vertical()` isolates the drag to vertical movement. For example:
- *
- * $("#images").on(".thumbnail","draginit", function(ev, drag){
- * drag.vertical();
- * });
- *
- * Call `vertical()` in "draginit" or "dragdown".
- *
- * @return {drag} the drag object for chaining.
- */
- vertical: function() {
- this._vertical = true;
- return this;
- },
- /**
- * `drag.horizontal()` isolates the drag to horizontal movement. For example:
- *
- * $("#images").on(".thumbnail","draginit", function(ev, drag){
- * drag.horizontal();
- * });
- *
- * Call `horizontal()` in "draginit" or "dragdown".
- *
- * @return {drag} the drag object for chaining.
- */
- horizontal: function() {
- this._horizontal = true;
- return this;
- },
- /**
- * `drag.only([only])` indicates if you __only__ want a drag motion and the drag should
- * not notify drops. The default value is `false`. Call it with no arguments or pass it true
- * to prevent drop events.
- *
- * $("#images").on(".thumbnail","dragdown", function(ev, drag){
- * drag.only();
- * });
- *
- * @param {Boolean} [only] true if you want to prevent drops, false if otherwise.
- * @return {Boolean} the current value of only.
- */
- only: function( only ) {
- return (this._only = (only === undefined ? true : only));
- },
-
- /**
- * `distance([val])` sets or reads the distance the mouse must move before a drag motion is started. This should be set in
- * "dragdown" and delays "draginit" being called until the distance is covered. The distance
- * is measured in pixels. The default distance is 0 pixels meaning the drag motion starts on the first
- * mousemove after a mousedown.
- *
- * Set this to make drag motion a little "stickier" to start.
- *
- * $("#images").on(".thumbnail","dragdown", function(ev, drag){
- * drag.distance(10);
- * });
- *
- * @param {Number} [val] The number of pixels the mouse must move before "draginit" is called.
- * @return {drag|Number} returns the drag instance for chaining if the drag value is being set or the
- * distance value if the distance is being read.
- */
- distance: function(val){
- if(val !== undefined){
- this._distance = val;
- return this;
- }else{
- return this._distance
- }
- }
- });
- /**
- * @add jQuery.event.special
- */
- event.setupHelper([
- /**
- * @attribute dragdown
- * @parent jQuery.event.drag
- *
- * `dragdown` is called when a drag movement has started on a mousedown.
- * The event handler gets an instance of [jQuery.Drag] passed as the second
- * parameter. Listening to `dragdown` allows you to customize
- * the behavior of a drag motion, especially when `draginit` should be called.
- *
- * $(".handles").delegate("dragdown", function(ev, drag){
- * // call draginit only when the mouse has moved 20 px
- * drag.distance(20);
- * })
- *
- * Typically, when a drag motion is started, `event.preventDefault` is automatically
- * called, preventing text selection. However, if you listen to
- * `dragdown`, this default behavior is not called. You are responsible for calling it
- * if you want it (you probably do).
- *
- * ### Why might you not want to call `preventDefault`?
- *
- * You might want it if you want to allow text selection on element
- * within the drag element. Typically these are input elements.
- *
- * $(".handles").delegate("dragdown", function(ev, drag){
- * if(ev.target.nodeName === "input"){
- * drag.cancel();
- * } else {
- * ev.preventDefault();
- * }
- * })
- */
- 'dragdown',
- /**
- * @attribute draginit
- * @parent jQuery.event.drag
- *
- * `draginit` is triggered when the drag motion starts. Use it to customize the drag behavior
- * using the [jQuery.Drag] instance passed as the second parameter:
- *
- * $(".draggable").on('draginit', function(ev, drag) {
- * // Only allow vertical drags
- * drag.vertical();
- * // Create a draggable copy of the element
- * drag.ghost();
- * });
- */
- 'draginit',
- /**
- * @attribute dragover
- * @parent jQuery.event.drag
- *
- * `dragover` is triggered when a drag is over a [jQuery.event.drop drop element].
- * The event handler gets an instance of [jQuery.Drag] passed as the second
- * parameter and an instance of [jQuery.Drop] passed as the third argument:
- *
- * $('.draggable').on('dragover', function(ev, drag, drop) {
- * // Add the drop-here class indicating that the drag
- * // can be dropped here
- * drag.element.addClass('drop-here');
- * });
- */
- 'dragover',
- /**
- * @attribute dragmove
- * @parent jQuery.event.drag
- *
- * `dragmove` is triggered when the drag element moves (similar to a mousemove).
- * The event handler gets an instance of [jQuery.Drag] passed as the second
- * parameter.
- * Use [jQuery.Drag::location] to determine the current position
- * as a [jQuery.Vector vector].
- *
- * For example, `dragmove` can be used to create a draggable element to resize
- * a container:
- *
- * $('.resizer').on('dragmove', function(ev, drag) {
- * $('#container').width(drag.location.x())
- * .height(drag.location.y());
- * });
- */
- 'dragmove',
- /**
- * @attribute dragout
- * @parent jQuery.event.drag
- *
- * `dragout` is called when the drag leaves a drop point.
- * The event handler gets an instance of [jQuery.Drag] passed as the second
- * parameter.
- *
- * $('.draggable').on('dragout', function(ev, drag) {
- * // Remove the drop-here class
- * // (e.g. crossing the drag element out indicating that it
- * // can't be dropped here
- * drag.element.removeClass('drop-here');
- * });
- */
- 'dragout',
- /**
- * @attribute dragend
- * @parent jQuery.event.drag
- *
- * `dragend` is called when the drag operation is completed.
- * The event handler gets an instance of [jQuery.Drag] passed as the second
- * parameter.
- *
- * $('.draggable').on('dragend', function(ev, drag)
- * // Calculation on whether revert should be invoked, alterations based on position of the end event
- * });
- */
- 'dragend',
- /**
- * @attribute dragcleanup
- * @parent jQuery.event.drag
- *
- * `dragcleanup` is called after dragend and revert (if applied)
- * The event handler gets an instance of [jQuery.Drag] passed as the second
- * parameter.
- *
- * $('.draggable').on('dragcleanup', function(ev, drag)
- * // cleanup
- * });
- */
- 'dragcleanup'], startEvent, function( e ) {
- $.Drag.mousedown.call($.Drag, e, this);
- });
-
+steal('jquery', 'jquery/event/drag/core', 'jquery/event/drag/step', 'jquery/event/drag/limit', function( $ ) {
return $;
});
\ No newline at end of file
diff --git a/event/drag/limit/limit.js b/event/drag/limit/limit.js
index f788ee80..8e221a66 100644
--- a/event/drag/limit/limit.js
+++ b/event/drag/limit/limit.js
@@ -2,7 +2,7 @@
* @add jQuery.Drag.prototype
*/
-steal('jquery', 'jquery/event/drag', 'jquery/dom/styles', function( $ ) {
+steal('jquery', 'jquery/event/drag/core', 'jquery/dom/styles', function( $ ) {
$.Drag.prototype
diff --git a/event/drag/step/step.js b/event/drag/step/step.js
index 758ae654..0461a0e3 100644
--- a/event/drag/step/step.js
+++ b/event/drag/step/step.js
@@ -2,7 +2,7 @@
* @add jQuery.Drag.prototype
*/
-steal('jquery', 'jquery/event/drag', 'jquery/dom/styles', function( $ ) {
+steal('jquery', 'jquery/event/drag/core', 'jquery/dom/styles', function( $ ) {
var round = function( x, m ) {
return Math.round(x / m) * m;
}
diff --git a/event/drop/drop.js b/event/drop/drop.js
index 3e689e37..4399e08b 100644
--- a/event/drop/drop.js
+++ b/event/drop/drop.js
@@ -1,4 +1,4 @@
-steal('jquery', 'jquery/event/drag', 'jquery/dom/within', 'jquery/dom/compare', function($){
+steal('jquery', 'jquery/event/drag/core', 'jquery/dom/within', 'jquery/dom/compare', function($){
var event = $.event;
/**
* @add jQuery.event.special
From eaf8aa6caa5c6f535540a1b7ef08a252d24df02c Mon Sep 17 00:00:00 2001
From: David Luecke
Date: Wed, 6 Feb 2013 15:13:51 -0700
Subject: [PATCH 034/105] Updating changelog, drag event
---
changelog.md | 10 ++++++++++
event/drag/drag.js | 5 +++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/changelog.md b/changelog.md
index 753b30a9..57a8e515 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,15 @@
### Change Log
+__1.0.1__
+
+- fix: [Force hover leave on new mouseenter](https://github.com/bitovi/jquerypp/pull/65)
+- fix: [Removing the element being hovered prevents all future hoverenter](https://github.com/bitovi/jquerypp/issues/64)
+- fix: [hover.leave != 0 prevents hover of next element with same selecto](https://github.com/bitovi/jquerypp/issues/63)
+- fix: [Changing jQuery references to local $](https://github.com/bitovi/jquerypp/pull/71)
+- fix: [Breaks in jQuery.noConflict(true) Scenario](https://github.com/bitovi/jquerypp/issues/67)
+- feature: [jQuery 1.9.x support](https://github.com/bitovi/jquerypp/commit/692ed50a7b43fb2c6bfb9d89c5e0505ddcbd6595)
+
+
__1.0.0__
- feature: jQuery 1.8.0+ compatibility
diff --git a/event/drag/drag.js b/event/drag/drag.js
index 1f44aa91..437c5ac9 100644
--- a/event/drag/drag.js
+++ b/event/drag/drag.js
@@ -1,3 +1,4 @@
-steal('jquery', 'jquery/event/drag/core', 'jquery/event/drag/step', 'jquery/event/drag/limit', function( $ ) {
- return $;
+steal('jquery', 'jquery/event/drag/core', 'jquery/event/drag/step', 'jquery/event/drag/limit',
+ 'jquery/event/drag/scroll', function( $ ) {
+ return $;
});
\ No newline at end of file
From 7101b15ee14944f781c8c3921710cc2dfb7b7403 Mon Sep 17 00:00:00 2001
From: David Luecke
Date: Wed, 6 Feb 2013 15:30:30 -0700
Subject: [PATCH 035/105] Updating changelog, adding jQuery plugin manifest
---
changelog.md | 3 ++-
jquerypp.jquery.json | 26 ++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 1 deletion(-)
create mode 100644 jquerypp.jquery.json
diff --git a/changelog.md b/changelog.md
index 57a8e515..2dd60838 100644
--- a/changelog.md
+++ b/changelog.md
@@ -7,8 +7,9 @@ __1.0.1__
- fix: [hover.leave != 0 prevents hover of next element with same selecto](https://github.com/bitovi/jquerypp/issues/63)
- fix: [Changing jQuery references to local $](https://github.com/bitovi/jquerypp/pull/71)
- fix: [Breaks in jQuery.noConflict(true) Scenario](https://github.com/bitovi/jquerypp/issues/67)
+- fix: [Can't download drag.limit, drag.step, and drag.scroll from downloader on website](https://github.com/bitovi/jquerypp/pull/66)
- feature: [jQuery 1.9.x support](https://github.com/bitovi/jquerypp/commit/692ed50a7b43fb2c6bfb9d89c5e0505ddcbd6595)
-
+- feature: Added to the new [jQuery plugin repository](http://plugins.jquery.com/jquerypp)
__1.0.0__
diff --git a/jquerypp.jquery.json b/jquerypp.jquery.json
new file mode 100644
index 00000000..46af4833
--- /dev/null
+++ b/jquerypp.jquery.json
@@ -0,0 +1,26 @@
+{
+ "name" : "jquerypp",
+ "title" : "jQuery++",
+ "description" : "I am a MIT licensed collection of extremely useful DOM helpers and special events for jQuery 1.8 and later.",
+ "keywords" : [ "drag", "drop", "ui", "animation", "events", "form", "jquery", "utility" ],
+ "version" : "1.0.1",
+ "author" : {
+ "name" : "Bitovi",
+ "email" : "contact@bitovi.com",
+ "web" : "http://bitovi.com/"
+ },
+ "licenses" : [
+ {
+ "type" : "MIT",
+ "url" : "https://github.com/bitovi/jquerypp/blob/master/license.md"
+ }
+ ],
+ "bugs" : "https://github.com/bitovi/jquerypp/issues",
+ "homepage" : "http://jquerypp.com",
+ "demo" : "http://jquerypp.com",
+ "docs" : "http://donejs.com/docs.html#!jquerypp",
+ "download" : "http://jquerypp.com/downloads/jquerypp.1.0.1.zip",
+ "dependencies" : {
+ "jquery" : ">=1.8"
+ }
+}
\ No newline at end of file
From a19aa53b4cade7aefed89dd46a88ad1e4b869ae4 Mon Sep 17 00:00:00 2001
From: David Luecke
Date: Wed, 6 Feb 2013 15:57:21 -0700
Subject: [PATCH 036/105] Updating build
---
grunt.js | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/grunt.js b/grunt.js
index a4c836f7..c87e9196 100644
--- a/grunt.js
+++ b/grunt.js
@@ -6,7 +6,7 @@ module.exports = function (grunt) {
};
var withExclude = _.extend({
_options : {
- exclude : [/\.min\./, /qunit\.js/]
+ exclude : [/steal\//, /\.min\./, /qunit\.js/]
}
}, outFiles);
@@ -51,6 +51,7 @@ module.exports = function (grunt) {
}
},
shell : {
+ makeSteal: 'rm -rf mkdir <%= meta.out %>/<%= pkg.version %>/steal && mkdir <%= meta.out %>/<%= pkg.version %>/steal && git archive HEAD | tar -x -C <%= meta.out %>/<%= pkg.version %>/steal',
bundleLatest : 'cd <%= meta.out %> && zip -r jquerypp.<%= pkg.version %>.zip <%= pkg.version %>/',
getGhPages : 'git clone -b gh-pages <%= pkg.repository.url %> build/gh-pages',
copyLatest : 'rm -rf build/gh-pages/release/<%= pkg.version %> && ' +
@@ -68,12 +69,28 @@ module.exports = function (grunt) {
}
},
bannerize : outFiles,
- docco : withExclude,
+ docco : {
+ edge : {
+ src : '<%= meta.out %>/edge/raw/**/*.js',
+ docco : {
+ output : '<%= meta.out %>/edge/docs'
+ }
+ },
+ latest : {
+ src : '<%= meta.out %>/<%= pkg.version %>/**/*.js',
+ docco : {
+ output : '<%= meta.out %>/<%= pkg.version %>/docs'
+ }
+ },
+ _options : {
+ exclude : [/\.min\./, /steal\//, /amd\//]
+ }
+ },
strip : withExclude
});
grunt.loadTasks("../build/tasks");
grunt.registerTask('edge', 'build:edge strip:edge beautify:dist bannerize:edge');
- grunt.registerTask('latest', 'build:latest strip:latest beautify:dist bannerize:latest');
- grunt.registerTask("ghpages", "shell:cleanup shell:getGhPages shell:copyLatest shell:updateGhPages shell:cleanup docco:latest");
+ grunt.registerTask('latest', 'build:latest strip:latest beautify:dist bannerize:latest shell:makeSteal docco:latest');
+ grunt.registerTask("ghpages", "shell:cleanup shell:getGhPages shell:copyLatest shell:updateGhPages shell:cleanup");
};
From 6e8e9b17b5def063cf4e216880f6e92fa67c0ab1 Mon Sep 17 00:00:00 2001
From: Alexis Abril
Date: Wed, 6 Feb 2013 21:28:42 -0600
Subject: [PATCH 037/105] Copying zip to downloads.
---
grunt.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/grunt.js b/grunt.js
index c87e9196..2116b3ed 100644
--- a/grunt.js
+++ b/grunt.js
@@ -56,6 +56,7 @@ module.exports = function (grunt) {
getGhPages : 'git clone -b gh-pages <%= pkg.repository.url %> build/gh-pages',
copyLatest : 'rm -rf build/gh-pages/release/<%= pkg.version %> && ' +
'cp -R <%= meta.out %>/<%= pkg.version %> build/gh-pages/release/<%= pkg.version %> && ' +
+ 'cp <%= meta.out %>/jquerypp.<%= pkg.version %>.zip build/gh-pages/downloads/ &&' +
'rm -rf build/gh-pages/release/latest && ' +
'cp -R <%= meta.out %>/<%= pkg.version %> build/gh-pages/release/latest',
copyEdge : 'rm -rf build/gh-pages/release/edge && ' +
From 071ddcc18df8b66e83545a101fe45a8d8aecf498 Mon Sep 17 00:00:00 2001
From: Alexis Abril
Date: Wed, 6 Feb 2013 21:43:57 -0600
Subject: [PATCH 038/105] Adding zips to grunt task. Adding deploy as well.
---
grunt.js | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/grunt.js b/grunt.js
index 2116b3ed..f2f9a7aa 100644
--- a/grunt.js
+++ b/grunt.js
@@ -52,11 +52,11 @@ module.exports = function (grunt) {
},
shell : {
makeSteal: 'rm -rf mkdir <%= meta.out %>/<%= pkg.version %>/steal && mkdir <%= meta.out %>/<%= pkg.version %>/steal && git archive HEAD | tar -x -C <%= meta.out %>/<%= pkg.version %>/steal',
- bundleLatest : 'cd <%= meta.out %> && zip -r jquerypp.<%= pkg.version %>.zip <%= pkg.version %>/',
+ bundleLatest : 'cd <%= meta.out %> && zip -r jquerypp-<%= pkg.version %>.zip <%= pkg.version %>/',
getGhPages : 'git clone -b gh-pages <%= pkg.repository.url %> build/gh-pages',
copyLatest : 'rm -rf build/gh-pages/release/<%= pkg.version %> && ' +
'cp -R <%= meta.out %>/<%= pkg.version %> build/gh-pages/release/<%= pkg.version %> && ' +
- 'cp <%= meta.out %>/jquerypp.<%= pkg.version %>.zip build/gh-pages/downloads/ &&' +
+ 'cp <%= meta.out %>/jquerypp-<%= pkg.version %>.zip build/gh-pages/downloads/ &&' +
'rm -rf build/gh-pages/release/latest && ' +
'cp -R <%= meta.out %>/<%= pkg.version %> build/gh-pages/release/latest',
copyEdge : 'rm -rf build/gh-pages/release/edge && ' +
@@ -92,6 +92,7 @@ module.exports = function (grunt) {
grunt.loadTasks("../build/tasks");
grunt.registerTask('edge', 'build:edge strip:edge beautify:dist bannerize:edge');
- grunt.registerTask('latest', 'build:latest strip:latest beautify:dist bannerize:latest shell:makeSteal docco:latest');
+ grunt.registerTask('latest', 'build:latest strip:latest beautify:dist bannerize:latest shell:makeSteal shell:bundleLatest docco:latest');
grunt.registerTask("ghpages", "shell:cleanup shell:getGhPages shell:copyLatest shell:updateGhPages shell:cleanup");
+ grunt.registerTask('deploy', 'latest ghpages');
};
From 1c6fe80cebdd8678f7dd6f4656ffb59db264b407 Mon Sep 17 00:00:00 2001
From: David Luecke
Date: Thu, 7 Feb 2013 13:34:12 -0700
Subject: [PATCH 039/105] Updating build
---
grunt.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grunt.js b/grunt.js
index f2f9a7aa..689f9bf9 100644
--- a/grunt.js
+++ b/grunt.js
@@ -92,7 +92,7 @@ module.exports = function (grunt) {
grunt.loadTasks("../build/tasks");
grunt.registerTask('edge', 'build:edge strip:edge beautify:dist bannerize:edge');
- grunt.registerTask('latest', 'build:latest strip:latest beautify:dist bannerize:latest shell:makeSteal shell:bundleLatest docco:latest');
+ grunt.registerTask('latest', 'build:latest docco:latest strip:latest beautify:dist bannerize:latest shell:makeSteal shell:bundleLatest');
grunt.registerTask("ghpages", "shell:cleanup shell:getGhPages shell:copyLatest shell:updateGhPages shell:cleanup");
grunt.registerTask('deploy', 'latest ghpages');
};
From b04fa2c9943a4b47e9508f99e18670a9e3bca299 Mon Sep 17 00:00:00 2001
From: David Luecke
Date: Thu, 7 Feb 2013 13:51:11 -0700
Subject: [PATCH 040/105] Move Docco task to the right spot
---
grunt.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grunt.js b/grunt.js
index 689f9bf9..37dcd2ee 100644
--- a/grunt.js
+++ b/grunt.js
@@ -92,7 +92,7 @@ module.exports = function (grunt) {
grunt.loadTasks("../build/tasks");
grunt.registerTask('edge', 'build:edge strip:edge beautify:dist bannerize:edge');
- grunt.registerTask('latest', 'build:latest docco:latest strip:latest beautify:dist bannerize:latest shell:makeSteal shell:bundleLatest');
+ grunt.registerTask('latest', 'build:latest strip:latest beautify:dist docco:latest bannerize:latest shell:makeSteal shell:bundleLatest');
grunt.registerTask("ghpages", "shell:cleanup shell:getGhPages shell:copyLatest shell:updateGhPages shell:cleanup");
grunt.registerTask('deploy', 'latest ghpages');
};
From 33bc4f89c9388ed1b985a6cf06277f37eec09424 Mon Sep 17 00:00:00 2001
From: Austin
Date: Fri, 22 Feb 2013 16:55:44 -0600
Subject: [PATCH 041/105] Bug fix for undefined references
Fix for issues when `offset` isn't a option but then references `left` and `top` below.
---
lang/vector/vector.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lang/vector/vector.js b/lang/vector/vector.js
index ba497cad..1a3a20c7 100644
--- a/lang/vector/vector.js
+++ b/lang/vector/vector.js
@@ -197,7 +197,7 @@ steal('jquery', function($){
if ( this[0] == window ) {
return new $.Vector(window.pageXOffset ? window.pageXOffset : document.documentElement.scrollLeft, window.pageYOffset ? window.pageYOffset : document.documentElement.scrollTop);
} else {
- var offset = this.offset();
+ var offset = this.offset() || {};
return new $.Vector(offset.left, offset.top);
}
};
From 9fb75b3a19b95be73b47a124c714189f522f0b5a Mon Sep 17 00:00:00 2001
From: Justin Meyer
Date: Wed, 20 Mar 2013 00:20:20 -0500
Subject: [PATCH 042/105] updates to jquerypp module names
---
build/lib.js | 44 +++++++++----------
class/class_test.js | 4 +-
class/qunit.html | 2 +-
controller/controller.html | 2 +-
controller/controller.js | 2 +-
controller/controller_test.js | 4 +-
controller/demo-update.html | 8 ++--
controller/pages/listening.md | 2 +-
controller/qunit.html | 2 +-
controller/route/qunit.html | 2 +-
controller/route/route.html | 2 +-
controller/route/route.js | 2 +-
controller/subscribe/funcunit.html | 2 +-
controller/subscribe/subscribe.html | 2 +-
controller/subscribe/subscribe.js | 4 +-
controller/view/qunit.html | 2 +-
.../view/test/qunit/controller_view_test.js | 4 +-
controller/view/test/qunit/qunit.js | 2 +-
controller/view/view.js | 2 +-
dom/animate/animate.html | 2 +-
dom/animate/animate.js | 2 +-
dom/animate/animate.md | 2 +-
dom/animate/animate_test.js | 4 +-
dom/animate/qunit.html | 4 +-
dom/closest/closest.js | 2 +-
dom/compare/compare.html | 2 +-
dom/compare/compare.md | 4 +-
dom/compare/compare_test.js | 4 +-
dom/compare/qunit.html | 2 +-
dom/cookie/cookie.js | 4 +-
dom/dimensions/dimensions.html | 2 +-
dom/dimensions/dimensions.js | 2 +-
dom/dimensions/dimensions.md | 4 +-
dom/dimensions/dimensions_test.js | 10 ++---
dom/dimensions/qunit.html | 2 +-
dom/form_params/form_params.html | 2 +-
dom/form_params/form_params.js | 4 +-
dom/form_params/form_params_test.js | 22 +++++-----
dom/form_params/formparams.md | 2 +-
dom/form_params/qunit.html | 2 +-
dom/range/qunit.html | 2 +-
dom/range/range.html | 2 +-
dom/range/range.js | 2 +-
dom/range/range_test.js | 4 +-
dom/route/qunit.html | 2 +-
dom/route/route.html | 4 +-
dom/route/route_test.js | 2 +-
dom/selection/qunit.html | 2 +-
dom/selection/selection.html | 2 +-
dom/selection/selection.js | 2 +-
dom/selection/selection.md | 2 +-
dom/selection/selection_test.js | 4 +-
dom/styles/qunit.html | 2 +-
dom/styles/styles.html | 2 +-
dom/styles/styles.md | 2 +-
dom/styles/styles_test.js | 6 +--
dom/within/within.js | 2 +-
event/default/default.html | 2 +-
event/default/default.js | 8 ++--
event/default/default.md | 2 +-
event/default/default_pause_test.html | 2 +-
event/default/default_pause_test.js | 4 +-
event/default/default_test.js | 4 +-
event/default/defaultjquery.html | 2 +-
event/default/qunit.html | 2 +-
event/destroyed/destroyed.html | 2 +-
event/destroyed/destroyed.js | 4 +-
event/destroyed/destroyed.md | 4 +-
event/destroyed/destroyed_menu.html | 2 +-
event/destroyed/destroyed_test.js | 4 +-
event/destroyed/qunit.html | 2 +-
event/drag/core/core.js | 8 ++--
event/drag/drag.html | 6 +--
event/drag/drag.js | 4 +-
event/drag/drag.md | 2 +-
event/drag/drag_test.js | 4 +-
event/drag/limit/limit.html | 2 +-
event/drag/limit/limit.js | 6 +--
event/drag/qunit.html | 2 +-
event/drag/scroll/scroll.js | 6 +--
event/drag/step/step.html | 2 +-
event/drag/step/step.js | 8 ++--
event/drop/drop.html | 2 +-
event/drop/drop.js | 8 ++--
event/drop/drop.md | 2 +-
event/drop/drop_test.js | 4 +-
event/drop/qunit.html | 2 +-
event/fastfix/fastfix_test.js | 4 +-
event/fastfix/qunit.html | 2 +-
event/hover/hover.html | 2 +-
event/hover/hover.js | 6 +--
event/hover/hover.md | 2 +-
event/hover/hover_test.js | 4 +-
event/hover/qunit.html | 2 +-
event/key/customizer.html | 2 +-
event/key/key.html | 2 +-
event/key/key.js | 2 +-
event/key/key.md | 4 +-
event/key/key_test.js | 4 +-
event/key/qunit.html | 2 +-
event/mousehold/mousehold.js | 6 +--
event/move/move.js | 2 +-
event/pause/pause.html | 2 +-
event/pause/pause.js | 2 +-
event/pause/pause.md | 2 +-
event/pause/pause_test.js | 4 +-
event/pause/qunit.html | 2 +-
event/resize/demo.html | 2 +-
event/resize/qunit.html | 2 +-
event/resize/resize.html | 2 +-
event/resize/resize.js | 2 +-
event/resize/resize_test.js | 4 +-
event/reverse/qunit.html | 2 +-
event/reverse/reverse.html | 2 +-
event/reverse/reverse_test.js | 4 +-
event/selection/qunit.html | 2 +-
event/selection/selection.html | 2 +-
event/selection/selection.js | 2 +-
event/selection/selection_test.js | 4 +-
event/swipe/qunit.html | 2 +-
event/swipe/swipe.html | 2 +-
event/swipe/swipe.js | 2 +-
event/swipe/swipe_test.js | 4 +-
event/tap/tap.html | 2 +-
event/tap/tap.js | 2 +-
lang/object/object.html | 2 +-
lang/object/qunit.html | 2 +-
lang/observe/delegate/delegate.js | 2 +-
lang/observe/delegate/delegate_test.js | 4 +-
lang/observe/demo.html | 8 ++--
lang/observe/observe.html | 2 +-
lang/observe/observe_test.js | 4 +-
lang/observe/qunit.html | 2 +-
lang/openajax/openajax.html | 2 +-
lang/qunit.html | 2 +-
lang/string/deparam/deparam_test.js | 2 +-
lang/string/deparam/qunit.html | 2 +-
lang/string/qunit.html | 2 +-
lang/string/rsplit/rsplit.js | 2 +-
lang/string/string.html | 2 +-
lang/string/string_test.js | 2 +-
lang/vector/vector_test.js | 2 +-
model/backup/backup.html | 8 ++--
model/backup/qunit.html | 2 +-
model/backup/qunit/qunit.js | 4 +-
model/demo-convert.html | 4 +-
model/demo-dom.html | 2 +-
model/demo-encapsulate.html | 10 ++---
model/demo-events.html | 8 ++--
model/demo-setter.html | 6 +--
model/list/cookie/cookie.html | 6 +--
model/list/cookie/cookie.js | 10 ++---
model/list/cookie/qunit.html | 2 +-
model/list/cookie/qunit/qunit.js | 4 +-
model/list/list-insert.html | 6 +--
model/list/list.html | 6 +--
model/list/list.js | 2 +-
model/list/list_test.js | 4 +-
model/list/local/local.js | 6 +--
model/list/memory.html | 6 +--
model/list/qunit.html | 2 +-
model/modelBinder.html | 2 +-
model/pages/associations.html | 6 +--
model/pages/encapsulate.md | 2 +-
model/pages/typeconversion.md | 4 +-
model/qunit.html | 2 +-
model/service/json_rest/json_rest.js | 2 +-
model/service/service.js | 2 +-
model/service/twitter/twitter.html | 2 +-
model/service/twitter/twitter.js | 2 +-
model/service/yql/yql.html | 2 +-
model/service/yql/yql.js | 2 +-
model/store/qunit.html | 2 +-
model/store/store.html | 10 ++---
model/store/store.js | 2 +-
model/store/store_test.js | 6 +--
model/test/qunit/associations_test.js | 2 +-
model/test/qunit/model_test.js | 14 +++---
model/test/qunit/qunit.js | 8 ++--
model/validations/demo.html | 10 ++---
model/validations/qunit.html | 2 +-
model/validations/qunit/validations_test.js | 4 +-
model/validations/validations.html | 8 ++--
model/validations/validations.js | 2 +-
qunit.html | 2 +-
test/qunit/integration.js | 10 ++---
test/qunit/jmvc.js | 12 ++---
test/run.js | 6 +--
test/test.js | 36 +++++++--------
view/ejs/ejs.js | 2 +-
view/ejs/ejs_test.js | 8 ++--
view/ejs/qunit.html | 2 +-
view/helpers/helpers.js | 2 +-
view/jaml/jaml.js | 4 +-
view/micro/micro.js | 2 +-
view/qunit.html | 2 +-
view/test/compression/compression.html | 2 +-
view/test/compression/compression.js | 10 ++---
view/test/compression/run.js | 20 ++++-----
view/test/qunit/hookupvalcall.ejs | 2 +-
view/test/qunit/large.ejs | 18 ++++----
view/test/qunit/qunit.js | 2 +-
view/test/qunit/view_test.js | 24 +++++-----
view/tmpl/tmpl.js | 6 +--
view/tmpl/tmpl_test.js | 6 +--
view/view.html | 8 ++--
206 files changed, 431 insertions(+), 431 deletions(-)
diff --git a/build/lib.js b/build/lib.js
index f7f30099..47c87186 100644
--- a/build/lib.js
+++ b/build/lib.js
@@ -1,26 +1,26 @@
steal("jquery",
- "jquery/dom/animate",
- "jquery/dom/compare",
- "jquery/dom/cookie",
- "jquery/dom/dimensions",
- "jquery/dom/form_params",
- "jquery/dom/range",
- "jquery/dom/selection",
- "jquery/dom/styles",
- "jquery/dom/within",
- "jquery/event/default",
- "jquery/event/destroyed",
- "jquery/event/drag",
- 'jquery/event/drag/limit',
- 'jquery/event/drag/scroll',
- 'jquery/event/drag/step',
- "jquery/event/drop",
- "jquery/event/fastfix",
- "jquery/event/hover",
- "jquery/event/key",
- "jquery/event/pause",
- "jquery/event/resize",
- "jquery/event/swipe",
+ "jquerypp/dom/animate",
+ "jquerypp/dom/compare",
+ "jquerypp/dom/cookie",
+ "jquerypp/dom/dimensions",
+ "jquerypp/dom/form_params",
+ "jquerypp/dom/range",
+ "jquerypp/dom/selection",
+ "jquerypp/dom/styles",
+ "jquerypp/dom/within",
+ "jquerypp/event/default",
+ "jquerypp/event/destroyed",
+ "jquerypp/event/drag",
+ 'jquerypp/event/drag/limit',
+ 'jquerypp/event/drag/scroll',
+ 'jquerypp/event/drag/step',
+ "jquerypp/event/drop",
+ "jquerypp/event/fastfix",
+ "jquerypp/event/hover",
+ "jquerypp/event/key",
+ "jquerypp/event/pause",
+ "jquerypp/event/resize",
+ "jquerypp/event/swipe",
function($) {
return $;
});
\ No newline at end of file
diff --git a/class/class_test.js b/class/class_test.js
index 61caa64d..f43182c5 100644
--- a/class/class_test.js
+++ b/class/class_test.js
@@ -1,7 +1,7 @@
-steal("jquery/class") //load your app
+steal("jquerypp/class") //load your app
.then('funcunit/qunit').then(function(){
-module("jquery/class");
+module("jquerypp/class");
test("Creating", function(){
diff --git a/class/qunit.html b/class/qunit.html
index 503f699f..4de23a46 100644
--- a/class/qunit.html
+++ b/class/qunit.html
@@ -10,6 +10,6 @@
-
+