Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = function(grunt) {
grunt.initConfig({
qunit: {
files: ['test/index.html']
files: ['test/*.html']
}
});

Expand Down
5 changes: 3 additions & 2 deletions jquery.mask.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();
Expand Down Expand Up @@ -249,4 +250,4 @@
});
};

})(jQuery);
})(window.jQuery || window.Zepto);
22 changes: 22 additions & 0 deletions test/test-for-zepto.html
Original file line number Diff line number Diff line change
@@ -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>