Merge commit 'rick/t487' into 0.5

This commit is contained in:
Anna Sobiepanek 2011-04-21 17:49:07 -04:00
Родитель dc1c887db7 e5fc341c22
Коммит b7b3509b58
2 изменённых файлов: 49 добавлений и 49 удалений

Просмотреть файл

@ -327,7 +327,36 @@
isArray: Array.isArray || function( array ) {
return toString.call( array ) === "[object Array]";
},
nop: function () {}
nop: function () {},
position: function( elem ) {
var clientRect = elem.getBoundingClientRect(),
bounds = {},
doc = elem.ownerDocument,
docElem = document.documentElement,
body = document.body,
clientTop, clientLeft, scrollTop, scrollLeft, top, left;
// Determine correct clientTop/Left
clientTop = docElem.clientTop || body.clientTop || 0;
clientLeft = docElem.clientLeft || body.clientLeft || 0;
// Determine correct scrollTop/Left
scrollTop = ( global.pageYOffset && docElem.scrollTop || body.scrollTop );
scrollLeft = ( global.pageXOffset && docElem.scrollLeft || body.scrollLeft );
// Temp top/left
top = Math.ceil( clientRect.top + scrollTop - clientTop );
left = Math.ceil( clientRect.left + scrollLeft - clientLeft );
for ( var p in clientRect ) {
bounds[ p ] = Math.round( clientRect[ p ] );
}
return Popcorn.extend({}, bounds, { top: top, left: left });
}
});
// Memoized GUID Counter
@ -394,34 +423,8 @@
return this;
},
// Popcorn Object Element Utils
position: function() {
var media = this.media,
clientRect = media.getBoundingClientRect(),
bounds = {},
doc = media.ownerDocument,
docElem = document.documentElement,
body = document.body,
clientTop, clientLeft, scrollTop, scrollLeft, top, left;
// Determine correct clientTop/Left
clientTop = docElem.clientTop || body.clientTop || 0;
clientLeft = docElem.clientLeft || body.clientLeft || 0;
// Determine correct scrollTop/Left
scrollTop = ( global.pageYOffset && docElem.scrollTop || body.scrollTop );
scrollLeft = ( global.pageXOffset && docElem.scrollLeft || body.scrollLeft );
// Temp top/left
top = Math.ceil( clientRect.top + scrollTop - clientTop );
left = Math.ceil( clientRect.left + scrollLeft - clientLeft );
for ( var p in clientRect ) {
bounds[ p ] = Math.round( clientRect[ p ] );
}
return Popcorn.extend({}, bounds, { top: top, left: left });
return Popcorn.position( this.media );
}
});
@ -856,8 +859,8 @@
return plugin;
};
// Popcorn Plugin Inheritance Helper Methods
// Internal use only
// Popcorn Plugin Inheritance Helper Methods
// Internal use only
Popcorn.plugin.getDefinition = function( name ) {
var registry = Popcorn.registryByName;
@ -869,7 +872,7 @@
Popcorn.error( "Cannot inherit from "+ name +"; Object does not exist" );
};
// Internal use only
// Internal use only
Popcorn.plugin.delegate = function( instance, name, plugins ) {
return function() {
@ -882,7 +885,7 @@
};
};
// Plugin inheritance
// Plugin inheritance
Popcorn.plugin.inherit = function( name, parents, definition, manifest ) {
@ -939,7 +942,7 @@
return pluginFn;
};
// Augment Popcorn;
// Augment Popcorn;
Popcorn.inherit = Popcorn.plugin.inherit;
// stores parsers keyed on filetype

Просмотреть файл

@ -51,7 +51,7 @@ test("API", function () {
test("Utility", function () {
expect(7);
expect(8);
// TODO: comprehensive tests for these utilities
equals( typeof Popcorn.forEach, "function" , "Popcorn.forEach is a provided utility function");
@ -61,10 +61,7 @@ test("Utility", function () {
equals( typeof Popcorn.sizeOf, "function" , "Popcorn.sizeOf is a provided utility function");
equals( typeof Popcorn.nop, "function" , "Popcorn.nop is a provided utility function");
equals( typeof Popcorn.addTrackEvent, "function" , "Popcorn.addTrackEvent is a provided utility function");
equals( typeof Popcorn.position, "function" , "Popcorn.position is a provided utility function");
});
test("Standard Time Strings" , function () {
@ -465,15 +462,15 @@ test("exec", function () {
module("Popcorn Position");
test("position", function () {
expect(25);
expect(25);
var $absolute = $(".absolute"),
$relative = $(".relative"),
$fixed = $(".fixed"),
$static = $(".static"),
tests;
$("#position-tests").show();
$("#position-tests").show();
// console.log( $absolute );
// console.log( $fixed );
// console.log( $relative );
@ -529,7 +526,7 @@ test("position", function () {
ok( false, e );
}
$("#position-tests").hide();
$("#position-tests").hide();
});
test("position called from plugin", function () {
@ -2372,14 +2369,14 @@ test("Last Check", function () {
} catch (e) {};
// Trigger follow-up tests to run in iframes
(function( $ ) {
// Trigger follow-up tests to run in iframes
(function( $ ) {
$("iframe[data-src]").attr( "src", function() {
return $(this).data("src");
});
})( jQuery );
$("iframe[data-src]").attr( "src", function() {
return $(this).data("src");
});
})( jQuery );
});