Show:

An object that encapsulates util methods for HTML5 shiving.

What is a "shiv"?

To the world, a shiv is a slang term for a sharp object used as a knife-like weapon. To Internet Explorer, a shiv is a script that, when executed, forces the browser to recognize HTML5 elements.

Methods

_doBeforeCreate

(
  • html
  • doc
  • tag
)
DocumentFragment protected

AOP listener to the A.DOM._create method. This method intercepts all the calls to the A.DOM._create and append the generated fragment to [A.HTML._fragHTML5Shived](A.HTML5.html#property__frag HTML5Shived), this fixes the IE bug for painting the HTML5 nodes on the HTML fragment.

Parameters:

  • html String

    HTML content

  • doc String
  • tag String

Returns:

DocumentFragment:

_getAllCSSText

() Array protected

Gets all CSS text from all stylesheets.

Returns:

Array:

_getAllStyleSheets

(
  • styleSheet,
)
Array protected

Gets all stylesheets from a page.

Parameters:

  • styleSheet, Object

    mediaType, level, buffer

Returns:

Array:

_getBodyClone

() Element protected

Gets a clone of the <body> element.

Returns:

Element:

_getBodyEl

() Element protected

Gets the <body> element.

Returns:

Element:

_getCSSTextFromRule

(
  • rule
)
String protected

Extracts the CSS text from a rule.

Parameters:

  • rule Object

Returns:

String:

_getDocFrag

() DocumentFragment protected

Gets a document fragment object.

Returns:

DocumentFragment:

_getStyleSheet

() Node protected

Gets the stylesheet from the DOM.

Returns:

Node:

IECreateFix

(
  • frag
  • content
)
Node | DocumentFragment

Receives a frag and a HTML content. This method shivs the HTML5 nodes appended to a Node or fragment which is not on the document yet.

Parameters:

  • frag Node | DocumentFragment

    Fragment to be fixed.

  • content String

    HTML to be set (using innerHTML) on the frag.

Returns:

Node | DocumentFragment:

onAfterPrint

()

Fires after a print.

onBeforePrint

()

Fires before a print.

parseCSS

(
  • cssText
)
String

Navigates through the CSS joining rules and replacing content.

Parameters:

  • cssText Object

Returns:

String:

restoreHTML

()

Restores the HTML from the bodyClone and bodyEl attributes.

writeHTML

()

Generates the HTML for print.

Properties

_fragHTML5Shived

DocumentFragment protected

A global DocumentFragment already HTML5 shived, for performance reasons. (i.e., all nodes and its HTML5 children appended to this fragment iherits the styles on IE).