4 ms·
I do that to be able to do: ƒ('ul li:nth-child(2n)', 'style.background = "black"').
by tsenart 16y ago
I do that to be able to do:
ƒ('ul li:nth-child(2n)', 'style.background = "black"').
- jessedhillon 16y agoA better way to do that would be to split() it first on '=' then, split() the left side on '.' and iterate the results. You don't want to evaluate just anything anyone puts in that second argument.
- tsenart 16y agoWell... Actually I do.
- jessedhillon 16y agoIf you want to eval anything anyone passes you with no consideration for what it could be, then I have to agree with OP that you must not be aware of the pitfalls of using eval. Consider that the "black" portion of that argument actually comes from user input and that you were passed instead: black"); alert('This framework is awesome! Try eval'ing that.