Add compatibilty for zepto #20

Merged
merged 3 commits into from Apr 23, 2013
Jump to file or symbol
Failed to load files and symbols.
+26 −3
Diff settings

Always

Just for now

View
@@ -1,7 +1,7 @@
module.exports = function(grunt) {
grunt.initConfig({
qunit: {
- files: ['test/index.html']
+ files: ['test/*.html']
}
});
View
@@ -88,7 +88,8 @@
return typeof mask == "function" ? mask(__p.getVal(), e, options) : mask;
},
setVal: function(v) {
- return $el.get(0).tagName.toLowerCase() === "input" ? $el.val(v) : $el.html(v);

This comment has been minimized.

@igorescobar

igorescobar Apr 22, 2013

Owner

Hi @igorlima why did you have to change this line? (Curiosity)?

@igorescobar

igorescobar Apr 22, 2013

Owner

Hi @igorlima why did you have to change this line? (Curiosity)?

This comment has been minimized.

@igorlima

igorlima Apr 22, 2013

Contributor

Using jQuery, the return of val(undefined) and html(undefined) methods is the own element.
Using Zepto, the return of those methods (if the param is undefined) wasn't the own element.
If the param has a different value than undefined, everything works ok.

@igorlima

igorlima Apr 22, 2013

Contributor

Using jQuery, the return of val(undefined) and html(undefined) methods is the own element.
Using Zepto, the return of those methods (if the param is undefined) wasn't the own element.
If the param has a different value than undefined, everything works ok.

+ $el.get(0).tagName.toLowerCase() === "input" ? $el.val(v) : $el.html(v);
+ return $el;
},
getVal: function() {
return $el.get(0).tagName.toLowerCase() === "input" ? $el.val() : $el.text();
@@ -249,4 +250,4 @@
});
};
-})(jQuery);
+})(window.jQuery || window.Zepto);
View
@@ -0,0 +1,22 @@
+<html>
+<head>
+ <title>Zepto-Mask-Plugin UnitTesting</title>
+ <script type="text/javascript" src="http://zeptojs.com/zepto.min.js"></script>
+ <script type="text/javascript" src="https://raw.github.com/madrobby/zepto/master/src/data.js"></script>
+ <script type="text/javascript" src="../jquery.mask.js"></script>
+ <script type="text/javascript" src="http://code.jquery.com/qunit/qunit-1.11.0.js"></script>
+ <link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.11.0.css" type="text/css" media="all">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+</head>
+<script type="text/javascript" src="jquery.mask.test.js"></script>
+
+</head>
+<body>
+ <h1 id="qunit-header">Zepto-Mask-Plugin QUnit Tests</h1>
+ <h2 id="qunit-banner"></h2>
+ <div id="qunit-testrunner-toolbar"></div>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture">test markup, will be hidden</div>
+</body>
+</html>