Permalink
Browse files

minor fixes

  • Loading branch information...
1 parent aec1fa5 commit 6f62175ea3dee3370a1598c0092703fbde10811a @matthewmueller matthewmueller committed Sep 24, 2012
Showing with 10 additions and 5 deletions.
  1. +1 −1 Makefile
  2. +6 −1 index.js
  3. +2 −2 lib/api/attributes.js
  4. +1 −1 test/cheerio.js
View
@@ -7,7 +7,7 @@ subl:
@subl lib/ test/ package.json index.js
test-cov: lib-cov
- @EXPRESS_COV=1 $(MAKE) test REPORTER=html-cov > coverage.html
+ @CHEERIO_COV=1 $(MAKE) test REPORTER=html-cov > coverage.html
lib-cov:
@jscoverage lib lib-cov
View
@@ -1,8 +1,13 @@
-exports = module.exports = process.env.EXPRESS_COV
+/**
+ * Export cheerio (with )
+ */
+
+exports = module.exports = process.env.CHEERIO_COV
? require('./lib-cov/cheerio')
: require('./lib/cheerio');
/*
Export the version
*/
+
exports.version = require('./package').version;
View
@@ -49,7 +49,7 @@ var attr = exports.attr = function(name, value) {
el.attribs = setAttr(el, name, value);
});
return this;
- } else if(elem.attribs[name]) {
+ } else if(Object.hasOwnProperty.call(elem.attribs, name)) {
// Get the (decoded) attribute
return decode(elem.attribs[name]);
}
@@ -60,7 +60,7 @@ var attr = exports.attr = function(name, value) {
*/
function removeAttribute(elem, name) {
- if (!isTag(elem.type) || !elem.attribs || !elem.attribs[name])
+ if (!isTag(elem.type) || !elem.attribs || !Object.hasOwnProperty.call(elem.attribs, name))
return;
if (rboolean.test(elem.attribs[name]))
View
@@ -10,7 +10,7 @@ var script = '<script src="script.js" type="text/javascript"></script>',
describe('cheerio', function() {
it('should get the version', function() {
- expect(/\d\.\d\.\d/.test($.version)).to.be.ok();
+ expect(/\d+\.\d+\.\d+/.test($.version)).to.be.ok();
});
it('$(null) should return be empty', function() {

0 comments on commit 6f62175

Please sign in to comment.