content: 'some<div>text</div>and<!--comment-->',
loc: {
start: { offset: 10, line: 1, column: 11 },
- end: { offset: 46, line: 1, column: 47 },
- source: 'some<div>text</div>and<!--comment-->'
+ end: { offset: 46, line: 1, column: 47 }
}
})
})
- test('textarea handles character references', () => {
+ test('textarea handles entities', () => {
const ast = parse('<textarea>&</textarea>', parserOptions)
const element = ast.children[0] as ElementNode
const text = element.children[0] as TextNode
content: '&',
loc: {
start: { offset: 10, line: 1, column: 11 },
- end: { offset: 15, line: 1, column: 16 },
- source: '&'
+ end: { offset: 15, line: 1, column: 16 }
}
})
})
content: 'some<div>text</div>and<!--comment-->',
loc: {
start: { offset: 7, line: 1, column: 8 },
- end: { offset: 43, line: 1, column: 44 },
- source: 'some<div>text</div>and<!--comment-->'
+ end: { offset: 43, line: 1, column: 44 }
}
})
})
content: '&',
loc: {
start: { offset: 7, line: 1, column: 8 },
- end: { offset: 12, line: 1, column: 13 },
- source: '&'
+ end: { offset: 12, line: 1, column: 13 }
}
})
})
content: 'some text',
loc: {
start: { offset: 14, line: 1, column: 15 },
- end: { offset: 23, line: 1, column: 24 },
- source: 'some text'
+ end: { offset: 23, line: 1, column: 24 }
}
})
})
content: '&ersand;',
loc: {
start: { offset: 0, line: 1, column: 1 },
- end: { offset: 11, line: 1, column: 12 },
- source: '&ersand;'
+ end: { offset: 11, line: 1, column: 12 }
}
})
})
content: '&ersand;',
loc: {
start: { offset: 7, line: 1, column: 8 },
- end: { offset: 20, line: 1, column: 21 },
- source: '"&ersand;"'
+ end: { offset: 20, line: 1, column: 21 }
}
})
expect(text2).toStrictEqual({
content: '&ersand;',
loc: {
start: { offset: 23, line: 1, column: 24 },
- end: { offset: 37, line: 1, column: 38 },
- source: '"&ersand;"'
+ end: { offset: 37, line: 1, column: 38 }
}
})
expect(text3).toStrictEqual({
content: '&!',
loc: {
start: { offset: 40, line: 1, column: 41 },
- end: { offset: 47, line: 1, column: 48 },
- source: '"&!"'
+ end: { offset: 47, line: 1, column: 48 }
}
})
})
content: '†',
loc: {
start: { offset: 0, line: 1, column: 1 },
- end: { offset: 6, line: 1, column: 7 },
- source: '†'
+ end: { offset: 6, line: 1, column: 7 }
}
})
})
constType: ConstantTypes.NOT_CONSTANT,
loc: {
start: { offset: 8, line: 1, column: 9 },
- end: { offset: 16, line: 1, column: 17 },
- source: 'a < b'
+ end: { offset: 16, line: 1, column: 17 }
}
},
loc: {
start: { offset: 5, line: 1, column: 6 },
- end: { offset: 19, line: 1, column: 20 },
- source: '{{ a < b }}'
+ end: { offset: 19, line: 1, column: 20 }
}
})
})
tag: 'img',
tagType: ElementTypes.ELEMENT,
props: [],
- isSelfClosing: false,
children: [],
loc: {
start: { offset: 0, line: 1, column: 1 },
- end: { offset: 5, line: 1, column: 6 },
- source: '<img>'
+ end: { offset: 5, line: 1, column: 6 }
},
codegenNode: undefined
})
content: 'hello</textarea</textarea0>',
loc: {
start: { offset: 10, line: 1, column: 11 },
- end: { offset: 37, line: 1, column: 38 },
- source: 'hello</textarea</textarea0>'
+ end: { offset: 37, line: 1, column: 38 }
}
})
})