| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
ve.dm.DefinitionListItemNode = function VeDmDefinitionListItemNode() { |
| 18 |
|
| 19 |
ve.dm.DefinitionListItemNode.super.apply( this, arguments ); |
| 20 |
}; |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
OO.inheritClass( ve.dm.DefinitionListItemNode, ve.dm.BranchNode ); |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
ve.dm.DefinitionListItemNode.static.name = 'definitionListItem'; |
| 29 |
|
| 30 |
ve.dm.DefinitionListItemNode.static.parentNodeTypes = [ 'definitionList' ]; |
| 31 |
|
| 32 |
ve.dm.DefinitionListItemNode.static.defaultAttributes = { |
| 33 |
style: 'term' |
| 34 |
}; |
| 35 |
|
| 36 |
ve.dm.DefinitionListItemNode.static.matchTagNames = [ 'dt', 'dd' ]; |
| 37 |
|
| 38 |
ve.dm.DefinitionListItemNode.static.toDataElement = function ( domElements ) { |
| 39 |
const style = domElements[ 0 ].nodeName.toLowerCase() === 'dt' ? 'term' : 'definition'; |
| 40 |
return { type: this.name, attributes: { style: style } }; |
| 41 |
}; |
| 42 |
|
| 43 |
ve.dm.DefinitionListItemNode.static.toDomElements = function ( dataElement, doc ) { |
| 44 |
const tag = dataElement.attributes && dataElement.attributes.style === 'term' ? 'dt' : 'dd'; |
| 45 |
return [ doc.createElement( tag ) ]; |
| 46 |
}; |
| 47 |
|
| 48 |
|
| 49 |
ve.dm.DefinitionListItemNode.static.describeChanges = function () { |
| 50 |
return ve.dm.ListNode.static.describeChanges.apply( this, arguments ); |
| 51 |
}; |
| 52 |
|
| 53 |
ve.dm.DefinitionListItemNode.static.describeChange = function () { |
| 54 |
return ve.dm.ListNode.static.describeChange.apply( this, arguments ); |
| 55 |
}; |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
ve.dm.modelRegistry.register( ve.dm.DefinitionListItemNode ); |