Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compatibilty for zepto #20

Merged
merged 3 commits into from Apr 23, 2013
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -1,7 +1,7 @@
module.exports = function(grunt) {
grunt.initConfig({
qunit: {
files: ['test/index.html']
files: ['test/*.html']
}
});

@@ -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);
$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)?

This comment has been minimized.

@igorlima

igorlima Apr 22, 2013
Author 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.

return $el;
},
getVal: function() {
return $el.get(0).tagName.toLowerCase() === "input" ? $el.val() : $el.text();
@@ -249,4 +250,4 @@
});
};

})(jQuery);
})(window.jQuery || window.Zepto);
@@ -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>
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.