| 1 | /*global Autolinker */ |
| 2 | /** |
| 3 | * @class Autolinker.htmlParser.ElementNode |
| 4 | * @extends Autolinker.htmlParser.HtmlNode |
| 5 | * |
| 6 | * Represents an HTML element node that has been parsed by the {@link Autolinker.htmlParser.HtmlParser}. |
| 7 | * |
| 8 | * See this class's superclass ({@link Autolinker.htmlParser.HtmlNode}) for more |
| 9 | * details. |
| 10 | */ |
| 11 | Autolinker.htmlParser.ElementNode = Autolinker.Util.extend( Autolinker.htmlParser.HtmlNode, { |
| 12 | |
| 13 | /** |
| 14 | * @cfg {String} tagName (required) |
| 15 | * |
| 16 | * The name of the tag that was matched. |
| 17 | */ |
| 18 | tagName : '', |
| 19 | |
| 20 | /** |
| 21 | * @cfg {Boolean} closing (required) |
| 22 | * |
| 23 | * `true` if the element (tag) is a closing tag, `false` if its an opening |
| 24 | * tag. |
| 25 | */ |
| 26 | closing : false, |
| 27 | |
| 28 | |
| 29 | /** |
| 30 | * Returns a string name for the type of node that this class represents. |
| 31 | * |
| 32 | * @return {String} |
| 33 | */ |
| 34 | getType : function() { |
| 35 | return 'element'; |
| 36 | }, |
| 37 | |
| 38 | |
| 39 | /** |
| 40 | * Returns the HTML element's (tag's) name. Ex: for an <img> tag, |
| 41 | * returns "img". |
| 42 | * |
| 43 | * @return {String} |
| 44 | */ |
| 45 | getTagName : function() { |
| 46 | return this.tagName; |
| 47 | }, |
| 48 | |
| 49 | |
| 50 | /** |
| 51 | * Determines if the HTML element (tag) is a closing tag. Ex: <div> |
| 52 | * returns `false`, while </div> returns `true`. |
| 53 | * |
| 54 | * @return {Boolean} |
| 55 | */ |
| 56 | isClosing : function() { |
| 57 | return this.closing; |
| 58 | } |
| 59 | |
| 60 | } ); |