1 57 package org.enhydra.xml.lazydom.html; 58 import org.enhydra.xml.lazydom.LazyElement; 59 import org.enhydra.xml.lazydom.LazyElementNoNS; 60 import org.w3c.dom.Node ; 61 import org.w3c.dom.Text ; 62 import org.w3c.dom.html.HTMLScriptElement; 63 64 65 71 public class HTMLScriptElementImpl 72 extends LazyHTMLElement 73 implements HTMLScriptElement 74 { 75 76 77 public String getText() 78 { 79 Node child; 80 String text; 81 82 child = getFirstChild(); 85 text = ""; 86 while ( child != null ) 87 { 88 if ( child instanceof Text ) 89 text = text + ( (Text ) child ).getData(); 90 child = child.getNextSibling(); 91 } 92 return text; 93 } 94 95 96 public void setText( String text ) 97 { 98 Node child; 99 Node next; 100 101 child = getFirstChild(); 104 while ( child != null ) 105 { 106 next = child.getNextSibling(); 107 removeChild( child ); 108 child = next; 109 } 110 insertBefore( getOwnerDocument().createTextNode( text ), getFirstChild() ); 111 } 112 113 114 public String getHtmlFor() 115 { 116 return getAttribute( "for" ); 117 } 118 119 120 public void setHtmlFor( String htmlFor ) 121 { 122 setAttribute( "for", htmlFor ); 123 } 124 125 126 public String getEvent() 127 { 128 return getAttribute( "event" ); 129 } 130 131 132 public void setEvent( String event ) 133 { 134 setAttribute( "event", event ); 135 } 136 137 public String getCharset() 138 { 139 return getAttribute( "charset" ); 140 } 141 142 143 public void setCharset( String charset ) 144 { 145 setAttribute( "charset", charset ); 146 } 147 148 149 public boolean getDefer() 150 { 151 return getBinary( "defer" ); 152 } 153 154 155 public void setDefer( boolean defer ) 156 { 157 setAttribute( "defer", defer ); 158 } 159 160 161 public String getSrc() 162 { 163 return getAttribute( "src" ); 164 } 165 166 167 public void setSrc( String src ) 168 { 169 setAttribute( "src", src ); 170 } 171 172 173 public String getType() 174 { 175 return getAttribute( "type" ); 176 } 177 178 179 public void setType( String type ) 180 { 181 setAttribute( "type", type ); 182 } 183 184 185 190 public HTMLScriptElementImpl( LazyHTMLDocument owner, LazyElement template, String name ) 191 { 192 super( owner, template, name ); 193 } 194 195 196 } 197 198 | Popular Tags |