Permalink
Browse files

gallery-2014.02.13-03-13 juandopazo gallery-transitionend

  • Loading branch information...
1 parent 55ade8d commit a7ed5c34c8517051025aa4889b046b1188261ec4 Ezequiel committed Feb 13, 2014
View
6 build/gallery-transitionend/gallery-transitionend-coverage.js
@@ -0,0 +1,6 @@
+if (typeof __coverage__ === 'undefined') { __coverage__ = {}; }
+if (!__coverage__['build/gallery-transitionend/gallery-transitionend.js']) {
+ __coverage__['build/gallery-transitionend/gallery-transitionend.js'] = {"path":"build/gallery-transitionend/gallery-transitionend.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":52}}},"2":{"name":"noop","line":13,"loc":{"start":{"line":13,"column":0},"end":{"line":13,"column":16}}},"3":{"name":"(anonymous_3)","line":16,"loc":{"start":{"line":16,"column":26},"end":{"line":16,"column":56}}},"4":{"name":"(anonymous_4)","line":26,"loc":{"start":{"line":26,"column":28},"end":{"line":26,"column":68}}},"5":{"name":"(anonymous_5)","line":29,"loc":{"start":{"line":29,"column":12},"end":{"line":29,"column":42}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":38,"column":80}},"2":{"start":{"line":3,"column":0},"end":{"line":11,"column":14}},"3":{"start":{"line":13,"column":0},"end":{"line":14,"column":1}},"4":{"start":{"line":16,"column":0},"end":{"line":21,"column":3}},"5":{"start":{"line":17,"column":4},"end":{"line":20,"column":5}},"6":{"start":{"line":18,"column":8},"end":{"line":18,"column":28}},"7":{"start":{"line":19,"column":8},"end":{"line":19,"column":20}},"8":{"start":{"line":23,"column":0},"end":{"line":23,"column":51}},"9":{"start":{"line":25,"column":0},"end":{"line":35,"column":3}},"10":{"start":{"line":27,"column":8},"end":{"line":27,"column":94}},"11":{"start":{"line":30,"column":8},"end":{"line":33,"column":9}},"12":{"start":{"line":31,"column":12},"end":{"line":31,"column":42}},"13":{"start":{"line":32,"column":12},"end":{"line":32,"column":40}}},"branchMap":{"1":{"line":17,"type":"if","locations":[{"start":{"line":17,"column":4},"end":{"line":17,"column":4}},{"start":{"line":17,"column":4},"end":{"line":17,"column":4}}]},"2":{"line":26,"type":"cond-expr","locations":[{"start":{"line":26,"column":21},"end":{"line":26,"column":25}},{"start":{"line":26,"column":28},"end":{"line":28,"column":5}}]},"3":{"line":30,"type":"if","locations":[{"start":{"line":30,"column":8},"end":{"line":30,"column":8}},{"start":{"line":30,"column":8},"end":{"line":30,"column":8}}]}},"code":["(function () { YUI.add('gallery-transitionend', function (Y, NAME) {","","var testElement = Y.config.doc.createElement('yuitestnode'),"," eventNames = {"," 'transition' : 'transitionend',"," 'WebkitTransition' : 'webkitTransitionEnd',"," 'MozTransition' : 'transitionend',"," 'OTransition' : 'oTransitionEnd',"," 'msTransition' : 'MSTransitionEnd'"," },"," eventName;","","function noop() {","}","","Y.Object.some(eventNames, function (evtName, styleName) {"," if (styleName in testElement.style) {"," eventName = evtName;"," return true;"," }","});","","Y.namespace('support').transitionend = !!eventName;","","Y.Event.define('transitionend', {"," on: !eventName ? noop : function (node, subscription, notifier) {"," subscription._handle = Y.Event.attach(eventName, notifier.fire, node._node, notifier);"," },"," detach: function (node, subscription) {"," if (subscription._handle) {"," subscription._handle.detach();"," subscription._handle = null;"," }"," }","});","","","}, 'gallery-2014.02.13-03-13', {\"requires\": [\"event-base\", \"event-synthetic\"]});","","}());"]};
+}
+var __cov_YzQ6jdWQEckP2creViSNJA = __coverage__['build/gallery-transitionend/gallery-transitionend.js'];
+__cov_YzQ6jdWQEckP2creViSNJA.s['1']++;YUI.add('gallery-transitionend',function(Y,NAME){__cov_YzQ6jdWQEckP2creViSNJA.f['1']++;__cov_YzQ6jdWQEckP2creViSNJA.s['2']++;var testElement=Y.config.doc.createElement('yuitestnode'),eventNames={'transition':'transitionend','WebkitTransition':'webkitTransitionEnd','MozTransition':'transitionend','OTransition':'oTransitionEnd','msTransition':'MSTransitionEnd'},eventName;__cov_YzQ6jdWQEckP2creViSNJA.s['3']++;function noop(){__cov_YzQ6jdWQEckP2creViSNJA.f['2']++;}__cov_YzQ6jdWQEckP2creViSNJA.s['4']++;Y.Object.some(eventNames,function(evtName,styleName){__cov_YzQ6jdWQEckP2creViSNJA.f['3']++;__cov_YzQ6jdWQEckP2creViSNJA.s['5']++;if(styleName in testElement.style){__cov_YzQ6jdWQEckP2creViSNJA.b['1'][0]++;__cov_YzQ6jdWQEckP2creViSNJA.s['6']++;eventName=evtName;__cov_YzQ6jdWQEckP2creViSNJA.s['7']++;return true;}else{__cov_YzQ6jdWQEckP2creViSNJA.b['1'][1]++;}});__cov_YzQ6jdWQEckP2creViSNJA.s['8']++;Y.namespace('support').transitionend=!!eventName;__cov_YzQ6jdWQEckP2creViSNJA.s['9']++;Y.Event.define('transitionend',{on:!eventName?(__cov_YzQ6jdWQEckP2creViSNJA.b['2'][0]++,noop):(__cov_YzQ6jdWQEckP2creViSNJA.b['2'][1]++,function(node,subscription,notifier){__cov_YzQ6jdWQEckP2creViSNJA.f['4']++;__cov_YzQ6jdWQEckP2creViSNJA.s['10']++;subscription._handle=Y.Event.attach(eventName,notifier.fire,node._node,notifier);}),detach:function(node,subscription){__cov_YzQ6jdWQEckP2creViSNJA.f['5']++;__cov_YzQ6jdWQEckP2creViSNJA.s['11']++;if(subscription._handle){__cov_YzQ6jdWQEckP2creViSNJA.b['3'][0]++;__cov_YzQ6jdWQEckP2creViSNJA.s['12']++;subscription._handle.detach();__cov_YzQ6jdWQEckP2creViSNJA.s['13']++;subscription._handle=null;}else{__cov_YzQ6jdWQEckP2creViSNJA.b['3'][1]++;}}});},'gallery-2014.02.13-03-13',{'requires':['event-base','event-synthetic']});
View
38 build/gallery-transitionend/gallery-transitionend-debug.js
@@ -0,0 +1,38 @@
+YUI.add('gallery-transitionend', function (Y, NAME) {
+
+var testElement = Y.config.doc.createElement('yuitestnode'),
+ eventNames = {
+ 'transition' : 'transitionend',
+ 'WebkitTransition' : 'webkitTransitionEnd',
+ 'MozTransition' : 'transitionend',
+ 'OTransition' : 'oTransitionEnd',
+ 'msTransition' : 'MSTransitionEnd'
+ },
+ eventName;
+
+function noop() {
+}
+
+Y.Object.some(eventNames, function (evtName, styleName) {
+ if (styleName in testElement.style) {
+ eventName = evtName;
+ return true;
+ }
+});
+
+Y.namespace('support').transitionend = !!eventName;
+
+Y.Event.define('transitionend', {
+ on: !eventName ? noop : function (node, subscription, notifier) {
+ subscription._handle = Y.Event.attach(eventName, notifier.fire, node._node, notifier);
+ },
+ detach: function (node, subscription) {
+ if (subscription._handle) {
+ subscription._handle.detach();
+ subscription._handle = null;
+ }
+ }
+});
+
+
+}, 'gallery-2014.02.13-03-13', {"requires": ["event-base", "event-synthetic"]});
View
1 build/gallery-transitionend/gallery-transitionend-min.js
@@ -0,0 +1 @@
+YUI.add("gallery-transitionend",function(e,t){function s(){}var n=e.config.doc.createElement("yuitestnode"),r={transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd"},i;e.Object.some(r,function(e,t){if(t in n.style)return i=e,!0}),e.namespace("support").transitionend=!!i,e.Event.define("transitionend",{on:i?function(t,n,r){n._handle=e.Event.attach(i,r.fire,t._node,r)}:s,detach:function(e,t){t._handle&&(t._handle.detach(),t._handle=null)}})},"gallery-2014.02.13-03-13",{requires:["event-base","event-synthetic"]});
View
38 build/gallery-transitionend/gallery-transitionend.js
@@ -0,0 +1,38 @@
+YUI.add('gallery-transitionend', function (Y, NAME) {
+
+var testElement = Y.config.doc.createElement('yuitestnode'),
+ eventNames = {
+ 'transition' : 'transitionend',
+ 'WebkitTransition' : 'webkitTransitionEnd',
+ 'MozTransition' : 'transitionend',
+ 'OTransition' : 'oTransitionEnd',
+ 'msTransition' : 'MSTransitionEnd'
+ },
+ eventName;
+
+function noop() {
+}
+
+Y.Object.some(eventNames, function (evtName, styleName) {
+ if (styleName in testElement.style) {
+ eventName = evtName;
+ return true;
+ }
+});
+
+Y.namespace('support').transitionend = !!eventName;
+
+Y.Event.define('transitionend', {
+ on: !eventName ? noop : function (node, subscription, notifier) {
+ subscription._handle = Y.Event.attach(eventName, notifier.fire, node._node, notifier);
+ },
+ detach: function (node, subscription) {
+ if (subscription._handle) {
+ subscription._handle.detach();
+ subscription._handle = null;
+ }
+ }
+});
+
+
+}, 'gallery-2014.02.13-03-13', {"requires": ["event-base", "event-synthetic"]});
View
17 src/gallery-transitionend/.gitignore
@@ -0,0 +1,17 @@
+build/
+node_modules/
+
+lib-cov
+*.seed
+*.log
+*.csv
+*.dat
+*.out
+*.pid
+*.gz
+
+pids
+logs
+results
+
+npm-debug.log
View
3 src/gallery-transitionend/.travis.yml
@@ -0,0 +1,3 @@
+language: node_js
+node_js:
+ - "0.10"
View
7 src/gallery-transitionend/HISTORY.md
@@ -0,0 +1,7 @@
+transitionend
+=============
+
+v0.0.1
+------
+
+* Initial release.
View
29 src/gallery-transitionend/README.md
@@ -0,0 +1,29 @@
+transitionend event for YUI
+===========================
+
+![Travis Build Status](https://api.travis-ci.org/juandopazo/yui3-transitionend.png)
+
+YUI cross-browser detection for the `transitionend` event.
+
+Getting Started
+---------------
+
+Create a new YUI instance for your application and populate it with the modules you need by specifying them as arguments to the `YUI().use()` method. YUI will automatically load any dependencies required by the modules you specify. Then use the `transitionend` event as you would any other DOM event. Additionally a `Y.support.transitionend` property is available to check if the browser supports the event.
+
+```javascript
+YUI({
+ gallery: 'gallery-2013.05.29-23-38'
+}).use('gallery-transitionend', function (Y) {
+
+ if (Y.support.transitionend) {
+ Y.one('.fade').on('transitionend', doSomethingAfterTransition);
+ } else {
+ doSomethingAfterTransition();
+ }
+
+ function doSomethingAfterTransition() {
+ // ...
+ }
+
+});
+```
View
10 src/gallery-transitionend/build.json
@@ -0,0 +1,10 @@
+{
+ "name": "gallery-transitionend",
+ "builds": {
+ "gallery-transitionend": {
+ "jsfiles": [
+ "js/transitionend.js"
+ ]
+ }
+ }
+}
View
33 src/gallery-transitionend/js/transitionend.js
@@ -0,0 +1,33 @@
+var testElement = Y.config.doc.createElement('yuitestnode'),
+ eventNames = {
+ 'transition' : 'transitionend',
+ 'WebkitTransition' : 'webkitTransitionEnd',
+ 'MozTransition' : 'transitionend',
+ 'OTransition' : 'oTransitionEnd',
+ 'msTransition' : 'MSTransitionEnd'
+ },
+ eventName;
+
+function noop() {
+}
+
+Y.Object.some(eventNames, function (evtName, styleName) {
+ if (styleName in testElement.style) {
+ eventName = evtName;
+ return true;
+ }
+});
+
+Y.namespace('support').transitionend = !!eventName;
+
+Y.Event.define('transitionend', {
+ on: !eventName ? noop : function (node, subscription, notifier) {
+ subscription._handle = Y.Event.attach(eventName, notifier.fire, node._node, notifier);
+ },
+ detach: function (node, subscription) {
+ if (subscription._handle) {
+ subscription._handle.detach();
+ subscription._handle = null;
+ }
+ }
+});
View
8 src/gallery-transitionend/meta/gallery-transitionend.json
@@ -0,0 +1,8 @@
+{
+ "gallery-transitionend": {
+ "requires": [
+ "event-base",
+ "event-synthetic"
+ ]
+ }
+}
View
30 src/gallery-transitionend/package.json
@@ -0,0 +1,30 @@
+{
+ "name": "gallery-task",
+ "version": "0.0.1",
+ "description": "YUI 3 promise yielding generators",
+ "author": "Juan Ignacio Dopazo <dopazo.juan@gmail.com>",
+ "bugs": {
+ "url": "https://github.com/juandopazo/yui3-transitionend/issues"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "shifter": "0.3.3",
+ "grover": "0.1.14"
+ },
+ "scripts": {
+ "test": "shifter --build-dir ./build && grover --server tests/unit/*.html"
+ },
+ "repository": {
+ "type": "git",
+ "url": "http://github.com/juandopazo/yui3-transitionend.git"
+ },
+ "licenses":[
+ {
+ "type" : "BSD",
+ "url" : "https://github.com/juandopazo/yui3-transitionend/blob/master/LICENSE.md"
+ }
+ ]
+}
View
46 src/gallery-transitionend/tests/unit/index.html
@@ -0,0 +1,46 @@
+<!doctype html>
+<html>
+<head>
+ <title>transitionend</title>
+ <script src="http://yui.yahooapis.com/3.10.1/build/yui/yui-min.js"></script>
+ <script src="js/tests.js"></script>
+ <meta charset="utf-8" />
+ <style>
+.test {
+ height: 100px;
+ width: 100px;
+ background: red;
+-webkit-transition: all 100ms linear;
+ -moz-transition: all 100ms linear;
+ -ms-transition: all 100ms linear;
+ -o-transition: all 100ms linear;
+ transition: all 100ms linear;
+}
+ </style>
+</head>
+<body class="yui3-skin-sam">
+ <div class="test"></div>
+ <div id="logger"></div>
+<script>
+YUI({
+ coverage: ['gallery-transitionend'],
+ filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'raw',
+ modules: {
+ 'gallery-transitionend': {
+ fullpath: '/build/gallery-transitionend/gallery-transitionend-min.js',
+ requires: [
+ 'event-base',
+ 'event-synthetic'
+ ]
+ }
+ }
+}).use('test-console', 'test', 'transitionend-tests', function(Y) {
+
+ (new Y.Test.Console()).render('#logger');
+
+ Y.Test.Runner.setName('transitionend');
+ Y.Test.Runner.run();
+});
+</script>
+</body>
+</html>
View
49 src/gallery-transitionend/tests/unit/js/tests.js
@@ -0,0 +1,49 @@
+YUI.add('transitionend-tests', function(Y) {
+
+ var Assert = Y.Test.Assert;
+
+ var suite = new Y.Test.Suite('transitionend');
+
+ suite.add(new Y.Test.Case({
+ name: 'support tests',
+ 'support is defined': function() {
+ Assert.isObject(Y.support, 'Y.support is not defined');
+ Assert.isBoolean(Y.support.transitionend, 'Y.support.transitionend is not defined');
+ }
+ }));
+
+ suite.add(new Y.Test.Case({
+ name: 'event tests',
+
+ _should: {
+ ignore: {
+ 'transitionend test': !Y.support.transitionend
+ }
+ },
+
+ 'transitionend test': function () {
+ var test = this,
+ node = Y.one('.test'),
+ startTime = Y.Lang.now();
+
+ node.on('transitionend', function () {
+ test.resume(function () {
+ Assert.isTrue(Y.Lang.now() > startTime, 'transition should take some time');
+ });
+ });
+ node.setStyle('width', '200px');
+
+ test.wait();
+ }
+ }));
+
+ Y.Test.Runner.add(suite);
+
+
+},'', {
+ requires: [
+ 'test',
+ 'gallery-transitionend',
+ 'node'
+ ]
+});

0 comments on commit a7ed5c3

Please sign in to comment.