//This is used so IE can use the classList api /*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js*/ if(typeof document!=="undefined"&&!("classList" in document.createElement("a"))){(function(j){if(!("HTMLElement" in j)&&!("Element" in j)){return}var a="classList",f="prototype",m=(j.HTMLElement||j.Element)[f],b=Object,k=String[f].trim||function(){return this.replace(/^\s+|\s+$/g,"")},c=Array[f].indexOf||function(q){var p=0,o=this.length;for(;p 1 && value === undefined) { return null; } else if (sel.length > 1 && value !== undefined) //You can set a bunch, though { $_.each(function (e){ return _attr(e, name, value); }); } else //Normal behavior { return _attr(sel, name, value); } }, /** * Sets or retrieves the text content of the element * specified by the current selector. If a value is * passed, it will set that value on the current element, * otherwise it will return the value of the current element * * @name text * @memberOf $_.dom * @function * @param [string] value * @return string * @type string */ text: function (value) { var oldValue, set, sel; sel = this.el; set = (value !== undefined) ? true : false; oldValue = sel.textContent; if(set) { sel.textContent = value; return value; } else { return oldValue; } }, /** * Sets or retrieves a css property of the element * specified by the current selector. If a value is * passed, it will set that value on the current element, * otherwise it will return the value of the css property * on the current element * * @name css * @memberOf $_.dom * @function * @param string property * @param [string] value * @return string * @type string */ css: function (prop, val) { //Return the current value if a value is not set if(val === undefined) { return _css(this.el, prop); } $_.each(function (e){ _css(e, prop, val); }); }, /** * Adds to the innerHTML of the current element, after the last child. * * @example $_("ul").dom.append("<li></li>") adds an li element to the end of the selected ul element * @name append * @memberOf $_.dom * @function * @param string htm */ append: function(htm) { this.el.insertAdjacentHTML('beforeend', htm); }, /** * Adds to the innerHTML of the selected element, before the current children * * @name prepend * @memberOf $_.dom * @function * @param string htm */ prepend: function(htm) { this.el.insertAdjacentHTML('afterbegin', htm); }, /** * Sets or gets the innerHTML propery of the element(s) passed * * @name html * @memberOf $_.dom * @function * @param [string] htm * @return string * @type string */ html: function(htm) { if(htm !== undefined) { this.el.innerHTML = htm; } //If the parameter is undefined, just return the current value return this.el.innerHTML; } }; $_.ext('dom', d); }());