pcirella / dynatree

Automatically exported from code.google.com/p/dynatree
0 stars 0 forks source link

Use data-... attributes for all node options and remove `eval()` calls from code #252

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently `eval()` is called to evaluate the `data`attribute.
This is considered evil 
(http://stackoverflow.com/questions/86513/why-is-using-javascript-eval-function-
a-bad-idea) and not allowed in `strict` mode 
(http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/)

We can replace `eval()` with `jQuery.parseJSON()`
As a consequence, the definition of

    <li data="url: 'http://jquery.com'">jQuery home

is not valid JSON and has to be rewritten with double quotes as 

    <li data='"url": "http://jquery.com"'>jQuery home

Original issue reported on code.google.com by moo...@wwwendt.de on 24 Nov 2011 at 8:22

GoogleCodeExporter commented 9 years ago
here's the patch.

Modifications of the markup may be a bit of a burden to users, so there should 
be a fallback or deprecation phase to ease migration

Original comment by moo...@wwwendt.de on 24 Nov 2011 at 8:32

Attachments:

GoogleCodeExporter commented 9 years ago
Maybe this should go with using different `data-...` attributes instead of a 
single `data`.

Original comment by moo...@wwwendt.de on 28 Dec 2011 at 5:49

GoogleCodeExporter commented 9 years ago
Issue 269 has been merged into this issue.

Original comment by moo...@wwwendt.de on 12 Jan 2012 at 7:20

GoogleCodeExporter commented 9 years ago

Original comment by moo...@wwwendt.de on 25 Jan 2012 at 7:01

GoogleCodeExporter commented 9 years ago
See also issue 276

Original comment by moo...@wwwendt.de on 25 Jan 2012 at 7:04

GoogleCodeExporter commented 9 years ago

Original comment by moo...@wwwendt.de on 26 Jan 2013 at 4:15

GoogleCodeExporter commented 9 years ago

Original comment by moo...@wwwendt.de on 6 Oct 2013 at 3:18