Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing '<' and '>' #9

Open
josher19 opened this issue Sep 13, 2012 · 1 comment · Fixed by gtzilla/fastFrag-utils#1
Open

Parsing '<' and '>' #9

josher19 opened this issue Sep 13, 2012 · 1 comment · Fixed by gtzilla/fastFrag-utils#1

Comments

@josher19
Copy link

fastFrag HTML => JSON Converter

Fails to convert from HTML to JSON fully when it encounters a '<' on json.fastfrag.org :

<div>
              <h5>LiveScript</h5>
<pre class="prettyprint lang-ls">
filter (< 3), [1 to 5] #=> [1, 2]
filter even, {a: 3, b: 4, c: 0} #=> {b: 4, c: 0}
filter (== \a), 'hahaha' #=> 'aaa'
</pre>
            </div>
            <div class="example-js">
              <h5>JavaScript</h5>
<pre class="prettyprint lang-js">
filter(odd, [1, 2, 3, 4, 5]); //=> [1, 3, 5]
filter(function(x){ return x <= 2; }, 
  {x: 4, y: 2, z: 8}); //=> {y: 2}
</pre>
</div>

The results get truncated at "<":

[
    {
        "content": [
            {
                "content": {
                    "text": "LiveScript"
                }, 
                "type": "h5"
            }, 
            {
                "content": [
                    {
                        "text": "\r\nfilter ("
                    }, 
                    {
                        "text": "<" // truncated!
                    }
                ], 
                "css": "prettyprint lang-ls", 
                "type": "pre"
            }
        ]
    }, 
    {
        "content": [
            {
                "content": {
                    "text": "JavaScript"
                }, 
                "type": "h5"
            }, 
            {
                "content": [
                    {
                        "text": "\r\nfilter(odd, [1, 2, 3, 4, 5]); //=> [1, 3, 5]\r\nfilter(function(x){ return x "
                    }, 
                    {
                        "text": "<" // // truncated!
                    }
                ], 
                "css": "prettyprint lang-js", 
                "type": "pre"
            }
        ], 
        "css": "example-js"
    }
]

Replacing < with &lt; or \u003c in HTML does not work as expected.

Is this a "security feature" or a bug?

@josher19
Copy link
Author

PS: This looks like a problem with testFrag-util rather than testFrag itself.

fastFrag.create({"content":" (<3) Less Than Works!","type":"div"})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant