Index: trunk/extensions/VisualEditor/modules/parser/mediawiki.parser.defines.js |
— | — | @@ -9,11 +9,7 @@ |
10 | 10 | } |
11 | 11 | |
12 | 12 | TagTk.prototype.toJSON = function () { |
13 | | - return { |
14 | | - type: 'TagTk', |
15 | | - name: this.name, |
16 | | - attribs: this.attribs |
17 | | - }; |
| 13 | + return $.extend( { type: 'TagTk' }, this ); |
18 | 14 | }; |
19 | 15 | |
20 | 16 | function EndTagTk( name, attribs ) { |
— | — | @@ -22,11 +18,7 @@ |
23 | 19 | this.attribs = attribs || []; |
24 | 20 | } |
25 | 21 | EndTagTk.prototype.toJSON = function () { |
26 | | - return { |
27 | | - type: 'EndTagTk', |
28 | | - name: this.name, |
29 | | - attribs: this.attribs |
30 | | - }; |
| 22 | + return $.extend( { type: 'EndTagTk' }, this ); |
31 | 23 | }; |
32 | 24 | |
33 | 25 | function SelfclosingTagTk( name, attribs ) { |
— | — | @@ -35,18 +27,14 @@ |
36 | 28 | this.attribs = attribs || []; |
37 | 29 | } |
38 | 30 | SelfclosingTagTk.prototype.toJSON = function () { |
39 | | - return { |
40 | | - type: 'SelfclosingTagTk', |
41 | | - name: this.name, |
42 | | - attribs: this.attribs |
43 | | - }; |
| 31 | + return $.extend( { type: 'SelfclosingTagTk' }, this ); |
44 | 32 | }; |
45 | 33 | |
46 | 34 | function NlTk( ) { |
47 | 35 | //this.type = 'NEWLINE'; |
48 | 36 | } |
49 | 37 | NlTk.prototype.toJSON = function () { |
50 | | - return { type: 'NlTk' }; |
| 38 | + return $.extend( { type: 'NlTk' }, this ); |
51 | 39 | }; |
52 | 40 | |
53 | 41 | function CommentTk( value ) { |
— | — | @@ -54,16 +42,13 @@ |
55 | 43 | this.value = value; |
56 | 44 | } |
57 | 45 | CommentTk.prototype.toJSON = function () { |
58 | | - return { |
59 | | - type: 'COMMENT', |
60 | | - value: this.value |
61 | | - }; |
| 46 | + return $.extend( { type: 'COMMENT' }, this ); |
62 | 47 | }; |
63 | 48 | function EOFTk( ) { |
64 | 49 | this.type = 'END'; |
65 | 50 | } |
66 | 51 | EOFTk.prototype.toJSON = function () { |
67 | | - return { type: 'EOFTk' }; |
| 52 | + return $.extend( { type: 'EOFTk' }, this ); |
68 | 53 | }; |
69 | 54 | |
70 | 55 | // A key-value pair |