Skip to content

Commit

Permalink
squashed commits for issue 105 - test for numeric attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
ironchefpython committed Oct 3, 2012
1 parent 16e7df7 commit e797dd4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -5,3 +5,4 @@ coverage.html
lib-cov lib-cov
.coverage_data .coverage_data
cover_html cover_html
.c9revisions
2 changes: 1 addition & 1 deletion lib/utils.js
Expand Up @@ -26,5 +26,5 @@ exports.isTag = function(type) {
* 0 = XML, 1 = HTML4 and 2 = HTML5 * 0 = XML, 1 = HTML4 and 2 = HTML5
*/ */


exports.encode = function(str) { return entities.encode(str, 0); }; exports.encode = function(str) { return entities.encode(String(str), 0); };
exports.decode = function(str) { return entities.decode(str, 2); }; exports.decode = function(str) { return entities.decode(str, 2); };
7 changes: 7 additions & 0 deletions test/api.attributes.js
Expand Up @@ -52,6 +52,13 @@ describe('$(...)', function() {
$apple.attr('href', 'http://github.com/"><script>alert("XSS!")</script><br'); $apple.attr('href', 'http://github.com/"><script>alert("XSS!")</script><br');
expect($apple.html()).to.not.contain('<script>alert("XSS!")</script>'); expect($apple.html()).to.not.contain('<script>alert("XSS!")</script>');
}); });

it('(key, value) : should coerce values to a string', function() {
var $apple = $('.apple', fruits);
$apple.attr('data-test', 1);
expect($apple[0].attribs['data-test']).to.equal('1');
expect($apple.attr('data-test')).to.equal('1');
});
}); });


describe('.removeAttr', function() { describe('.removeAttr', function() {
Expand Down

0 comments on commit e797dd4

Please sign in to comment.