org.xwiki.gwt.dom.client.internal.ie
Class IEDOMUtils

java.lang.Object
  extended by org.xwiki.gwt.dom.client.DOMUtils
      extended by org.xwiki.gwt.dom.client.internal.ie.IEDOMUtils

public class IEDOMUtils
extends DOMUtils

Contains methods from DOMUtils that require a different implementation in Internet Explorer.

Version:
$Id: IEDOMUtils.java 21741 2009-07-01 08:47:08Z mflorea $

Field Summary
 
Fields inherited from class org.xwiki.gwt.dom.client.DOMUtils
CDATA_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, HTML_BLOCK_LEVEL_INLINE_CONTAINERS, HTML_EMPTY_TAGS, HTML_FLOW_CONTAINERS, HTML_SPECIAL_BLOCK_LEVEL_ELEMENTS, UNSUPPORTED_NODE_TYPE
 
Constructor Summary
IEDOMUtils()
           
 
Method Summary
 void ensureBlockIsEditable(Element block)
          Ensures the given block-level element can be edited in design mode.
 java.lang.String getAttribute(Element element, java.lang.String name)
          Returns the value of the named attribute of the specified element.
 com.google.gwt.core.client.JsArrayString getAttributeNames(Element element)
          
 java.lang.String getComputedStyleProperty(Element el, java.lang.String propertyName)
          Returns the value of the specified CSS property for the given element as it is computed by the browser before it displays that element.
 java.lang.String getInnerText(Element element)
          We need our own implementation because the one provided by GWT includes commented text in the output.
 boolean hasAttribute(Element element, java.lang.String attrName)
          
 boolean hasAttributes(Element element)
          
 com.google.gwt.dom.client.Node importNode(Document doc, com.google.gwt.dom.client.Node externalNode, boolean deep)
          Creates a copy of a node from an external document that can be inserted into the given document.
 void setAttribute(Element element, java.lang.String name, java.lang.String value)
          Sets the value of the specified attribute for the given element.
 void setInnerHTML(Element element, java.lang.String html)
          Helps setting the inner HTML for an element, in a cross-browser manner, because IE seems to trim leading comments in the inner HTML.
 
Methods inherited from class org.xwiki.gwt.dom.client.DOMUtils
cloneNode, cloneNode, cloneNode, cloneNodeContents, comparePoints, deleteNodeContents, deleteNodeContents, deleteNodeContents, deleteSiblings, detach, extractNode, extractNode, extractNode, extractNodeContents, getAncestors, getChild, getFarthestInlineAncestor, getFirstAncestor, getFirstDescendant, getFirstLeaf, getFirstLeaf, getInstance, getLastLeaf, getLastLeaf, getLength, getNearestBlockContainer, getNearestCommonAncestor, getNearestFlowContainer, getNextLeaf, getNextLeaf, getNextNode, getNodeIndex, getNormalizedChildCount, getNormalizedNodeIndex, getPreviousLeaf, getPreviousLeaf, getPreviousNode, getTextRange, insertAfter, insertAt, isBlock, isBlockLevelInlineContainer, isFlowContainer, isInline, isSerializable, isSpecialBlock, scrollIntoView, splitHTMLNode, splitNode, splitNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IEDOMUtils

public IEDOMUtils()
Method Detail

getComputedStyleProperty

public java.lang.String getComputedStyleProperty(Element el,
                                                 java.lang.String propertyName)
Returns the value of the specified CSS property for the given element as it is computed by the browser before it displays that element. The CSS property doesn't have to be applied explicitly or directly on the given element. It can be inherited or assumed by default on that element.
NOTE: You have to pass the JavaScript name of the property and not its CSS name. The JavaScript name has camel case style (fontWeight) and it is used like this object.style.propertyJSName = value. The CSS name has dash style (font-weight) and it is used like this propertyCSSName: value;.

Specified by:
getComputedStyleProperty in class DOMUtils
Parameters:
el - the element for which we retrieve the property value.
propertyName - the script name of the CSS property whose value is returned.
Returns:
the computed value of the specified CSS property for the given element.
See Also:
DOMUtils.getComputedStyleProperty(Element, String)

importNode

public com.google.gwt.dom.client.Node importNode(Document doc,
                                                 com.google.gwt.dom.client.Node externalNode,
                                                 boolean deep)
Creates a copy of a node from an external document that can be inserted into the given document.

Overrides:
importNode in class DOMUtils
Parameters:
doc - The document in which we want to insert the returned copy.
externalNode - The node from another document to be imported.
deep - Indicates whether the children of the given node need to be imported.
Returns:
a copy of the given node that can be inserted into the specified document.
See Also:
DOMUtils.importNode(Document, Node, boolean)

getAttributeNames

public com.google.gwt.core.client.JsArrayString getAttributeNames(Element element)

Overrides:
getAttributeNames in class DOMUtils
Parameters:
element - The DOM element whose attribute names are returned.
Returns:
The names of DOM attributes present on the given element.
See Also:
DOMUtils.getAttributeNames(Element)

setInnerHTML

public void setInnerHTML(Element element,
                         java.lang.String html)
Helps setting the inner HTML for an element, in a cross-browser manner, because IE seems to trim leading comments in the inner HTML. This method is overwritten in IE's specific implementation.

Overrides:
setInnerHTML in class DOMUtils
Parameters:
element - element to set the inner HTML for
html - the HTML string to set
See Also:
DOMUtils.setInnerHTML(Element, String), http://code.google.com/p/google-web-toolkit/issues/detail?id=3146

getAttribute

public java.lang.String getAttribute(Element element,
                                     java.lang.String name)
Returns the value of the named attribute of the specified element. This method will be overwritten for Internet Explorer browsers to handle bug http://code.google.com/p/google-web-toolkit/issues/detail?id=3238 .

Overrides:
getAttribute in class DOMUtils
Parameters:
element - the element to get the attribute for
name - the name of the attribute to return
Returns:
the value of the attribute
See Also:
DOMUtils.getAttribute(Element, String)

setAttribute

public void setAttribute(Element element,
                         java.lang.String name,
                         java.lang.String value)
Sets the value of the specified attribute for the given element. This method will be overwritten for Internet Explorer to overcome that fact that the style attribute cannot be set in the standard way.

Overrides:
setAttribute in class DOMUtils
Parameters:
element - the element whose attribute is set
name - the name of the attribute
value - the value of the attribute
See Also:
DOMUtils.setAttribute(Element, String, String)

getInnerText

public java.lang.String getInnerText(Element element)
We need our own implementation because the one provided by GWT includes commented text in the output.

Overrides:
getInnerText in class DOMUtils
Parameters:
element - the element whose inner text to return
Returns:
the text between the start and end tags of the given element
See Also:
DOMUtils.getInnerText(Element)

hasAttribute

public boolean hasAttribute(Element element,
                            java.lang.String attrName)

Overrides:
hasAttribute in class DOMUtils
Parameters:
element - a DOM element
attrName - a string representing the name of an attribute
Returns:
true is the given element has an attribute with the specified name, false otherwise
See Also:
DOMUtils.hasAttribute(Element, String)

hasAttributes

public boolean hasAttributes(Element element)

Overrides:
hasAttributes in class DOMUtils
Parameters:
element - a DOM element
Returns:
true if the given element has any attributes
See Also:
DOMUtils.hasAttributes(Element)

ensureBlockIsEditable

public void ensureBlockIsEditable(Element block)
Ensures the given block-level element can be edited in design mode. This method is required because in some browsers you can't place the caret inside elements that don't have any visible content and thus you cannot edit them.

Overrides:
ensureBlockIsEditable in class DOMUtils
Parameters:
block - a block-level DOM element
See Also:
DOMUtils.ensureBlockIsEditable(Element)


Copyright © 2004-2009 XWiki. All Rights Reserved.