JX.JSON and JX.DOM.alterClass changes. #8

merged 2 commits into from Jun 24, 2011


None yet

2 participants

cpojer commented Jun 24, 2011

No description provided.

cpojer added some commits Jun 23, 2011
@cpojer cpojer Add JX.JSON.parse, update JX.JSON.serialize
Summary: Add functionality to decode a JSON string into an object.
Rename JX.JSON.serialize to stringify to match the ES5 method name. Both
will use their native counterparts if available. They are not spec
compliant, ie. they do not support replacer/receiver j0nx. Cleaned up
some of the stringify code. JX.JSON.parse is intended to never throw, it
will return the parsed object or null. The idea is that if it would
throw in dev but you rely on it to return null to check if the data
contained a value, you would have to cover both the exception and the
null check in your application code.

Test Plan: verify that both methods can properly decode and encode JSON

Reviewers: tomo, epriestley, mroch


Differential Revision: 510
@cpojer cpojer Throw when alterClass is called without third arg
Summary: If no third argument is provided, this method will behave
differently depending on whether the element has the class or not.
Javelin discourages state management through className. Throwing an
error in DEV can help developers spot this mistakte.

Test Plan: Test that it throws in DEV if anything but true or false are
provided as third argument.

Reviewers: mroch, epriestley, tomo


Differential Revision: 511
@epriestley epriestley merged commit 716f939 into phacility:master Jun 24, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment