new TripParser()
TripParser - this is the parser that helps us parse DOM elements and return needed information to TripCore. By doing so, users can easily define their own trips from HTML.
Methods
-
<static> _getAllTripNodes() → {Array}
-
We will find out all pre-defined DOM elements from DOM tree.
Returns:
Array of Element
- Type
- Array
-
<static> _parseTripData(node) → {Object}
-
we will use this function to parse out all needed information and wrap them into a tripData object then pass it out.
TODO - http://caniuse.com/#search=dataset IE 8~10 can't use dataset directly, so we may need to use getAttribute for this case later.
Parameters:
Name Type Description node
Element Returns:
TripData
- Type
- Object
-
<static> parse(selector) → {Array}
-
This is the main entry point to use tripParser.
Parameters:
Name Type Description selector
String selector to matches nodes from DOM tree
Returns:
Array of tripDatas
- Type
- Array