The scoping class burst.xml.HtmlBox has utilities specifically about element size and location.
Static Public Member Functions | |
String | getDocumentScriptSrc (String matching, Boolean mustFind) |
Extract the full 'src' attribute value of the 'script' element in this document which matches the provided regexp or string. | |
void | addClassValue (Element node, String val, Boolean first) |
Add the provided value to any existing value for the "class" attribute of the provided Element. | |
Boolean | removeClassValue (Node node, String val) |
Remove the id val from the "class" attribute of the provided Element. | |
String | getStyleProperty (Node node, String propName) |
Get a single style property. | |
void | setStyleProperty (Node node, String propName, String propVal) |
Set a single style property (in node.style). | |
Number | maxZIndex (DomDocument doc) |
finds the maximum z-index set in the document. | |
String | getComputedStyle (Node node, String attname) |
Get computed style value. | |
Number | parseStylePixels (String s, String attname, Number fallback) |
Convert a string like '30' or '30px' into a number like 30. | |
Number | getComputedStylePixels (Node node, String attname, Number fallback) |
returns a number if fallback is not defined, and it finds a non-empty string it can't parse as a number, it throws. | |
String | stylePropertyName (String attname) |
convert an "attribute name" (such as "font-size") to a "property name" (such as "fontSize"). | |
Node | getDocumentElementIE (DomDocument doc) |
Return doc.body or doc.documentElement according to IE compatMode. | |
Object | parseStyle (String text) |
Parse a string which follows the conventions of a CSS style declaration. | |
String | getWindowBaseUrl (Window win, Boolean recurse_parent) |
Return the base URI for the provided window. | |
String | resolveWindowUrl (String url, Window win) |
Resolve the uri relative to the provided window. | |
Element | iframeCreate (String iframe_id, String srcval, String onloadval, Function create_cb, Boolean as_visible) |
Create a hidden iframe element child in the current document. | |
Window | iframeContentWindow (Element iframe_el) |
Go from iframe element (in the parent document) to the iframe window object. | |
Document | iframeContentDocument (Element iframe_el) |
Get the Document object for the iframe. | |
Location | iframeLocation (Element iframe_el) |
Get the Location object for the iframe element. | |
void | iframeReplaceContents (Element iframe_el, String html) |
Replaces the contents of the iframe with the provided html. |
|
Add the provided value to any existing value for the "class" attribute of the provided Element. If there no "class" already or it has the empty value, it is set to this. Otherwise if first is true, it is prepended, otherwise appended, always preserving space separation. Also, it checks to see if it is already present, and if so, does nothing.
|
|
Get computed style value. See: http://www.xs4all.nl/~ppk/js/w3c_css.html http://www.w3.org/TR/1998/REC-CSS2-19980512/cascade.html#computed-value The getPropertyValue function takes a CSS hyphenated "style attribute" name like 'font-size', 'z-index', 'background-color'. When using members of a style object, such as node.style['color'], it is necessary to have "style property" member names like 'fontSize', 'zIndex', 'backgroundColor'. Mozilla supports getComputedStyle. In Mozilla, both node.style and getComputedStyle support access both by getPropertyValue(attname) and by propname members. Safari (upcoming) supports getComputedStyle. The IE style and currentStyle objects support access only by propname, both as expando and using getAttribute. IE also has a runtimeStyle object, which can be used for overrides. Opera 7.0 supports neither currentStyle nor getComputedStyle. Opera 7.5 supports getComputedStyle but not currentStyle. At least in O7.0 , its style object does expand out 'border' and 'padding' settings to their individual property values, though still preserving the original units: if it was 'padding: 0.25in', then there will be a 'padding-left' value of '0.25in'. But it otherwise does not have a way to retrieve a computed style attribute. The return value is always a String. An empty string means no value. (This is how the style object works in all browsers). The standard says that computed values should in fact be computed numbers. This is not always the case; some browsers return the actually set strings, or return nothing at all. Mozilla will return a number + 'px' value for some attributes regardless of whether they were explicitly set or not, and regardless of whether it was set by an expression such 'auto' or '37%' or '5in'. These reliable attribute names include: 'width', 'padding-left', 'padding-right' 'border-left-width', 'border-right-width', 'margin-left', 'margin-right', 'height', 'padding-top', 'padding-bottom' 'border-top-width', 'border-bottom-width', 'margin-top', 'margin-bottom' This does not include: 'left', 'right', 'top', 'bottom', Furthermore, if just 'border' or 'padding' is set explicitly in css, Mozilla getComputedStyle will return appropriate values for the particular measurements on each side such as 'border-left-width' (the reverse is not true). IE's currentStyle object does not generally do conversion. If a node style is 'width: 37%', then currentStyle['width'] == '37%'. Like Opera, it does expand border and padding settings to the individual ones, preserving original units. Note that the CSS rules may be accessed via: document.styleSheets[0].cssRules[0].style.borderWidth |
|
Return doc.body or doc.documentElement according to IE compatMode. Only for use with Internet Explorer. |
|
Extract the full 'src' attribute value of the 'script' element in this document which matches the provided regexp or string. It checks the type of its first argument). This is useful when generating a script "src" value, because it will be interpreted relative to the base url of the document which included this file (location object), *not* relative to this file.
|
|
Get a single style property. This returns the computed (aka 'current') style. |
|
Return the base URI for the provided window. It determines this from these sources:
(Note that Content-Base is not in the HTTP 1.1 RFC (it is not in 2616, only 2068), so 'META http-equiv="Content-Base" content="http://w.com/"' is a non-issue.) In an xml document, the "xml:base" attribute is relevant: http://www.w3.org/TR/xmlbase/ However, as that could appear anywhere in the hierarchy, we don't deal with it. In general, the string this function returns might be absolute or relative. See http://www.w3.org/TR/REC-html40/struct/links.html#resolving-relative-uris If a base element is provided, it must have an href attribute, which must be an absolute URI.
|
|
Get the Document object for the iframe. Note: iframe_el.document, which is set in Opera and IE6, is the containing document, not the document of the iframe. It should *not* be used. |
|
Go from iframe element (in the parent document) to the iframe window object. Current W3 standards define contentDocument but do not require a contentWindow method. Here a bit of the sad story we work around here:
|
|
Create a hidden iframe element child in the current document.
|
|
Replaces the contents of the iframe with the provided html.
Calls |
|
finds the maximum z-index set in the document. returns null if none set. |
|
Parse a string which follows the conventions of a CSS style declaration.
Any example might be Note that this does not parse a CSS rule (which would include selectors and {}). Just the body declaration, as might appear in a style attribute.
This is not a perfect emulation. If you have a real style, you should use the style object and call the official Returns an associative array with keys being property names. Both names and values have surrounding white space stripped. Quoted values are unquoted, if the entire value string (between ':' and ';') is quoted. If the value string contains an internal quoted string, it is preserved. |
|
Remove the id val from the "class" attribute of the provided Element.
|
|
Resolve the uri relative to the provided window. The logic is:
The result may still not be an absolute url. |