Commits

David Håsäther committed 50d9a81

Some minor changes, mostly changing strict equal check to `undefined` to equal check for `null`.

Comments (0)

Files changed (1)

             child = child.nextElementSibling;
         }
     }
-    else if (subject._elements !== undefined) {
+    else if (subject._elements != null) {
         this._elements = subject._elements;
     }
     else if (isFunction(subject)) {
      *   specific position.
      */
     add: function(eles) {
+        // FIXME: this is wrong, send it through Unbose instead
         this._elements = this._elements.concat(new Unbose(eles)._elements);
         this.length = this._elements.length;
         return this;
      */
     filter: function(selector) {
         var eles = this._elements;
-        if (selector !== undefined) {
+        if (selector != null) {
             eles = eles.filter(function(ele) {
                 return new Unbose(ele).matchesSelector(selector);
             });
      */
     elem: function(index) {
         if (index < 0) { index = (index % this.length) + this.length; }
-        return (index === undefined) ? this._elements : this[index];
+        return (index == null) ? this._elements : this[index];
     },
 
     /**
      *
      */
     slice: function(start, end, step) {
-        // Gecko does not treat `undefined` correctly for the end parameter
-        // in Array.prototype.slice, so set it explicitly
-        if (end === undefined) { end = this.length; }
         var eles = this._elements.slice(start, end);
         if (step) {
             eles = eles.filter(function(ele, idx) {
         else if (Array.isArray(thing)) {
             return this._insertElem(eleFromTpl(thing), append);
         }
-        else if (thing._elements !== undefined) { // thing is an unbose object
+        else if (thing._elements != null) { // thing is an unbose object
             return thing._elements.forEach(function(e) {
                 this._insertElem(e, append);
             }, this);
      *
      */
     attr: function(name, val) {
-        if (val === undefined) {
+        if (val == null) {
             return this[0] && this[0].getAttribute(name);
         }
         else {
      *
      */
     empty: function() {
-        return this._elements.forEach(function(ele) {
-            ele.textContent = "";
-        });
+        return this.text("");
     },
 
     /**
      *
      */
     text: function(text) {
-        if (text === undefined) {
+        if (text == null) {
             return (this[0] && this[0].textContent) || "";
         }
         else {
      *
      */
     val: function(val) {
-        if (val === undefined) {
+        if (val == null) {
             return this[0] && this[0].value;
         }
         else {
      *
      */
     data: function(name, prop) {
-        if (prop === undefined) {
+        if (prop == null) {
             return this[0] && this[0]["unbose-" + name];
         }
 
      *
      */
     width: function(value) {
-        if (value === undefined) {
+        if (value == null) {
             if (!this[0]) { return 0; }
             return this._getDimensions().width -
                 parseInt(this._getStyle("border-left-width"), 10) -
      *
      */
     height: function(value) {
-        if (value === undefined) {
+        if (value == null) {
             if (!this[0]) { return 0; }
             return this._getDimensions().height -
                 parseInt(this._getStyle("border-top-width"), 10) -