Changeset 27719
- Timestamp:
- 01/01/09 11:07:26 (4 years ago)
- Files:
-
- 1 modified
-
lang/javascript/nohada/js/TagBuilder.class.js (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/nohada/js/TagBuilder.class.js
r27703 r27719 32 32 return this.addObj(k); 33 33 }, 34 insert: function (elem,index) {35 if (index==null) index=0;36 return this.insertAt(index, elem);37 },38 34 setDecoy: function (funcs) { 39 35 var pl=function () {}; … … 51 47 t.parent.appendChild(r); 52 48 }, 53 insertRow:function (idx) { 49 insertRow:function () { 50 checkTagName(target.tagName,"table"); 54 51 return e=t.parent.insertRow(t.parent.rows.length); 55 52 }, 56 insertCell: function (idx) { 53 insertCell: function () { 54 checkTagName(target.tagName,"tr"); 57 55 return e=t.parent.insertCell(t.parent.cells.length); 58 56 } … … 76 74 return this.addObj(a); 77 75 }, 78 /*insertAt: function (index, expr) { 76 insert: function (expr, index) { 77 if (index==null) index=0; 79 78 var target=this.target; 80 79 this.setDecoy({ … … 82 81 target.insertBefore(r, target.childNodes[index]); 83 82 }, 84 insertRow:function (idx) { 85 this.target=t.parent.insertRow(index); 83 insertRow:function () { 84 checkTagName(target.tagName,"table"); 85 return this.target=target.insertRow(index); 86 86 }, 87 insertCell: function (idx) { 88 this.target=t.parent.insertCell(index); 87 insertCell: function () { 88 checkTagName(target.tagName,"tr"); 89 return this.target=target.insertCell(index); 89 90 } 90 91 }); … … 92 93 this.target=target; 93 94 return this; 94 }, */95 }, 95 96 addStr: function (s) { 96 97 var target=this.target; … … 160 161 function addNewElement(target, tagName) { 161 162 var res; 162 if (tagName =="tr") {163 //if (target.tagName!="TABLE") alert("Tag is not table: "+target.tagName);163 if (tagName.eqi("tr")) { 164 target.isDecoy || checkTagName(target.tagName,"table"); 164 165 res=target.insertRow(target.isDecoy ? null : target.rows.length); 165 166 } else if (tagName=="td") { 166 //if (target.tagName!="TR") alert("Tag is not tr: "+target.tagName);167 target.isDecoy || checkTagName(target.tagName,"tr"); 167 168 res=target.insertCell(target.isDecoy ? null : target.cells.length); 168 169 } else { … … 172 173 return res; 173 174 } 175 String.prototype.eqi=function (to) { 176 return this.toLowerCase()==to.toLowerCase(); 177 }; 178 function checkTagName(a,b) { 179 a.eqi(b) || alert("<"+a+">!=<"+b+">"); 180 } 174 181 TagBuilder.getBody=function () { 175 182 return $tag($$("body")[0]);
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)