1 21 package org.lobobrowser.html.domimpl; 22 23 import org.w3c.dom.*; 24 25 public class HTMLTitleElementImpl extends HTMLElementImpl { 26 public HTMLTitleElementImpl(String name) { 27 super(name, true); 28 } 29 30 public Object setUserData(String key, Object data, UserDataHandler handler) { 31 if(org.lobobrowser.html.parser.HtmlParser.MODIFYING_KEY.equals(key) && data == Boolean.FALSE) { 32 Document document = this.document; 33 if(document instanceof HTMLDocumentImpl) { 34 String textContent = this.getTextContent(); 35 String title = textContent == null ? null : textContent.trim(); 36 ((HTMLDocumentImpl) document).setTitle(title); 37 } 38 } 39 return super.setUserData(key, data, handler); 40 } 41 42 43 } 44 | Popular Tags |