himalaya
himalaya copied to clipboard
Code in script block may break output
Input:
<div>
<script>
console.log('</')
</script>
</div>
Output:
[
{
"type": "element",
"tagName": "div",
"attributes": [],
"children": [
{
"type": "text",
"content": "\n "
},
{
"type": "element",
"tagName": "script",
"attributes": [],
"children": [
{
"type": "text",
"content": "\n console.log('"
},
{
"type": "attribute",
"content": "<"
},
{
"type": "tag-end"
},
{
"type": "text",
"content": "cript>\n"
}
]
}
]
}
]
Hmm; this ought to be fixed, it should work as you expect and has some special handling already: https://github.com/andrejewski/himalaya/blob/master/src/tags.js#L5
@07akioni are you interested in making the fix and adding tests to prevent it from regressing? I'll review any PRs 😄
Hmm; this ought to be fixed, it should work as you expect and has some special handling already: https://github.com/andrejewski/himalaya/blob/master/src/tags.js#L5
@07akioni are you interested in making the fix and adding tests to prevent it from regressing? I'll review any PRs 😄
I may have a try later. In this period I am a little busy😂
Hi,
I'm also seeing template tags getting parsed (although in my case, it's cool).
input:
<select style="width:200px;height:20px;font-size:11px;" v-model="content.dataRef">
<template v-for="src in dataRefs">
<option :value="src">{{ src }}</option>
</template>
</select>
output:
[
{
"type": "element",
"tagName": "select",
"attributes": [
{
"key": "style",
"value": "width:200px;height:20px;font-size:11px;"
},
{
"key": "v-model",
"value": "content.dataRef"
}
],
"children": [
{
"type": "element",
"tagName": "template",
"attributes": [
{
"key": "v-for",
"value": "src in dataRefs"
}
],
"children": [
{
"type": "text",
"content": "<option :value=\"src\">{{ src }}</option>"
}
]
}
]
}
]
In the 'parser.js' file I didn't really see where the childlessTags get a look, but line 121 might be a fit with another || arrayIncludes(childless...).
If I knew how to use Github I'd test this theory out and do PR, ... but check the name (Noob). Thanks again for this work!!