Mercurial > nebulaweb3
view default/node_modules/shoestring/src/dom/html.js @ 0:1d038bc9b3d2 default tip
Up:default
author | Liny <dev@neowd.com> |
---|---|
date | Sat, 31 May 2025 09:21:51 +0800 |
parents | |
children |
line wrap: on
line source
//>>excludeStart("exclude", pragmas.exclude); define([ "shoestring" ], function(){ //>>excludeEnd("exclude"); var set = function( html ){ if( typeof html === "string" || typeof html === "number" ){ return this.each(function(){ this.innerHTML = "" + html; }); } else { var h = ""; if( typeof html.length !== "undefined" ){ for( var i = 0, l = html.length; i < l; i++ ){ h += html[i].outerHTML; } } else { h = html.outerHTML; } return this.each(function(){ this.innerHTML = h; }); } }; /** * Gets or sets the `innerHTML` from all the elements in the set. * * @param {string|undefined} html The html to assign * @return {string|shoestring} * @this shoestring */ shoestring.fn.html = function( html ){ //>>includeStart("development", pragmas.development); if( !!html && typeof html === "function" ){ shoestring.error( 'html-function' ); } //>>includeEnd("development"); if( typeof html !== "undefined" ){ return set.call( this, html ); } else { // get var pile = ""; this.each(function(){ pile += this.innerHTML; }); return pile; } }; //>>excludeStart("exclude", pragmas.exclude); }); //>>excludeEnd("exclude");