html.js is part of Aloha Editor project http://www.alohaeditor.org
Aloha Editor ● JavaScript Content Editing Library
Copyright (c) 2010-2015 Gentics Software GmbH, Vienna, Austria.
Contributors http://www.alohaeditor.org/docs/contributing.html
Aloha Editor ● JavaScript Content Editing Library
Copyright (c) 2010-2015 Gentics Software GmbH, Vienna, Austria.
Contributors http://www.alohaeditor.org/docs/contributing.html
Methods
-
hasBlockStyle(node){boolean}
-
Checks whether the given node is rendered with block style.
A block node is either an Element whose "display" property does not have
resolved value "inline" or "inline-block" or "inline-table" or "none", or
a Document, or a DocumentFragment.
Note that this function depends on style inheritance which only works if
the given node is attached to the document.Name Type Description node
Node -
hasInlineStyle(node){boolean}
-
Checks whether the given node is rendered with inline style.
An inline node is a node that is not a block node.
Note that this function depends on style inheritance which only works if
the given node is attached to the document.Name Type Description node
Node -
hasLinebreakingStyle(node){boolean}
-
Returns true for nodes that introduce linebreaks.
Unlike hasBlockStyle...Name Type Description node
Node -
isBlockNode(node){boolean}
-
Similar to hasBlockStyle() except relies on the nodeName of the given
node which works for attached as well as and detached nodes.
Will return true if the given node is a block node type--regardless of
how it is rendered.Name Type Description node
Node -
isGroupContainer(node){boolean}
-
Checks if the given node is grouping container.
Grouping containers include TABLE, FIELDSET, SELECT.Name Type Description node
Node - See:
-
- GROUP_CONTAINERS
-
isGroupedElement(node){boolean}
-
Checks if the given node an element that can only be a child of a group
container.
LI, TD are the classic cases.Name Type Description node
Node - See:
-
- GROUPED_CONTAINER
-
isHeading(node){boolean}
-
Whether the given node is a heading element.
Name Type Description node
Node -
isInlineNode(node){boolean}
-
Similar to hasInlineStyle() in the same sense as isBlockNode() is similar
to hasBlockStyle().
Will return true if the given node is an inline node type--regardless of
how it is rendered.Name Type Description node
Node -
isListContainer(node){boolean}
-
Checks if the given node is one of the 4 list grouping containers.
Name Type Description node
Node -
isListItem(node){boolean}
-
Checks if the given node is one of the 4 list item elements.
Name Type Description node
Node -
isRendered(node){boolean}
-
Returns true of the given node is rendered.
Name Type Description node
Node -
isTableContainer(node){boolean}
-
Checks whether `node` is the TABLE element.
Name Type Description node
Node -
isTextLevelSemanticNode(node){boolean}
-
Check whether the given node is a text-level semantic element type.
Name Type Description node
Node -
isUnrendered(node){boolean}
-
Checks whether the given node is visually rendered according to HTML5
specification.Name Type Description node
Node -
isVoidNode(node){boolean}
-
Check whether the given node is a void element type.
Name Type Description node
Node -
isVoidType(node){boolean}
-
Checks whether the given node should be treated like a void element.
Void elements like IMG and INPUT are considered as void type, but so are
"block" (elements inside of editale regions that are not themselves
editable).Name Type Description node
Node -
parse(html, doc){Array.<Node>}
-
Parses the given markup string and returns an array of detached top-level
elements. Event handler attributes will not trigger immediately to prevent
XSS, so aloha.editor.parse('<img src="" onerror="alert(1)">', document);
will NOT generate an alert box. See https://github.com/alohaeditor/Aloha-Editor/issues/1270
for details.Name Type Description html
string doc
Document -
prop(elem)
-
"Props up" the given element if needed.
The HTML specification stipulates that empty block-level elements should
not be rendered. This becomes a problem if an editing operation results
in one of these elements being emptied of all its child nodes. If this
were to happen, standard conformant browsers will no longer render that
empty block element even though it will remain in the document. Because
the element is invisible, it will no longer be possible for the caret to
be placed into it.
In order to prevent littering the editable with invisible block-level
elements, we prop them up by ensuring the empty block-level elements are
given a <br> child node to force them to be rendered with one line
height.
The notable exception to this rule is the Microsoft's non-standard
conformant Trident engine which automatically renders empty editable
block level elements with one line height.Name Type Description elem
Element