Class: IE8Compatibility

IE8Compatibility()

Utility functions for MS Internet Explorer 8 compatibility.

Constructor

new IE8Compatibility()

Not actually a constructor as there are no instance methods; underlying definition is an empty object. Documented as a class for the purposes of this documentation generator only.

Source:

Extends

Classes

IE8EventHandler

Members

(private, static) allRegisteredHandlers :Array.<IE8Compatibility.IE8EventHandler>

Cache of IE8Compatibility.IE8EventHandlers containing EventListeners registered via attachEvent.

Type:
Source:

Methods

(private, static) _getTextContent(nodeList) → {string}

Recursive helper for IE8Compatibility.getTextContent. Returns the concatenation of all descendant child nodes that are of type TEXT_NODE (3). A depth-first traversal is performed, as is specified in the DOM living standard for Node.textContent.

Parameters:
Name Type Description
nodeList NodeList

Children of the current node being processed.

Source:
Returns:

The depth-first concatenation of the values of all descendant child nodes that are of type TEXT_NODE (3).

Type
string

(static) addEventListener(target, type, listener, useCaptureopt)

Adds compatibility for the DOM EventTarget.addEventListener function.

If addEventListener is defined on target, simply calls target.addEventListener(type, listener, useCapture), otherwise falls back to the IE-specific attachEvent function. This implies useCapture, if defined, can either be a boolean or an options object, but will be ignored if falling back to attachEvent.

In either case, if listener is an EventListener, handleEvent will be called upon receiving an event (either natively if addEventListener is defined on target, or via anonymous closure if falling back to attachEvent).

Parameters:
Name Type Attributes Default Description
target EventTarget

Target to which the given listener is to be added.

type string

Type name of the event for which the given listener is to be added.

listener function | EventListener

Listener to add to the given target.

useCapture boolean | object <optional>
false

Use capture/options argument for addEventListener; ignored if necessary to fall back to attachEvent.

Source:

(static) extend(proto)

Adds compatibility for Object.create for the specific use-case of prototype-based inheritance.

Parameters:
Name Type Description
proto object

Prototype property of the desired parent (superclass) constructor.

Source:

(static) getEventTarget(event)

Adds compatibility for the DOM Event.target property. If target is not a defined property of the given event, returns event.srcElement.

Parameters:
Name Type Description
event Event

Event whose target is to be determined.

Source:
Returns:

The event.target property of event if target is a defined property on event, otherwise event.srcElement.

(private, static) getHandlerIndex(target, type, listener) → {number}

Finds the index of the corresponding IE8Compatibility.IE8EventHandler for the given target, type and listener in IE8Compatibility.allRegisteredHandlers. Returns -1 if not found.

Parameters:
Name Type Description
target EventTarget

Target whose corresponding IE8Compatibility.IE8EventHandler is to be obtained.

type string

Event type whose corresponding IE8Compatibility.IE8EventHandler is to be obtained.

listener EventListener

EventListener registered on the given target for the given event type.

Source:
Returns:

Index of the corresponding IE8Compatibility.IE8EventHandler for the given target, type and listener, or -1 if no matching IE8Compatibility.IE8EventHandler could be found.

Type
number

(static) getTextContent(node) → {string}

Adds compatibility for the Node.textContent property. Returns node.textContent if the textContent property is in node, otherwise the return value is as follows:

The depth-first concatenation of the nodeValue of all the child nodes of node that are of type TEXT_NODE (3) if node is of type:

  • ELEMENT_NODE (1)
  • DOCUMENT_FRAGMENT_NODE (11)

The nodeValue of node if node is of type:

  • TEXT_NODE (3)
  • CDATA_SECTION_NODE (4)
  • PROCESSING_INSTRUCTION_NODE (7)
  • COMMENT_NODE (8)

Or the value of node if node is of type ATTRIBUTE_NODE (2), and null if node is of any other type. This is designed to be consistent with the definition of textContent in the DOM Living Standard.

Parameters:
Name Type Description
node Node

Node whose text content is to be obtained.

Source:
See:
Returns:

The textContent of node, or a value consistent with its definition in the DOM living standard.

Type
string

(static) removeEventListener(target, type, listener, useCaptureopt)

Adds compatibility for the DOM EventTarget.removeEventListener function. Follows the same fallback pattern as IE8Compatibility.addEventListener, except with removeEventListener and detachEvent.

Parameters:
Name Type Attributes Default Description
target EventTarget

Target from which the given listener is to be removed.

type string

Type name of the event for which the given listener is to be removed.

listener function | EventListener

Listener to be removed.

useCapture boolean | object <optional>
false

Use capture/options argument for removeEventListener; ignored if necessary to fall back to detachEvent.

Source:

(static) setTextContent(node, text)

The corresponding setter function for IE8Compatibility.getTextContent.

Parameters:
Name Type Description
node Node

Node whose text content is to be set.

text string

Text content to set on node.

Source:
See: