better contiguous spaces handling in class lists #4

Merged
merged 1 commit into from Jul 30, 2012

Projects

None yet

2 participants

Contributor
tjk commented Jul 30, 2012

Note: I did not update chibi-min.

This commit allows for:

$(selector).cls("classA   classB classC          classD")

to properly set class attribute to classA classB classC classD.

More importantly, it also ensures the class attribute value is stripped on replace / remove actions so that:

<p class="classA classB">test</p>
$(".classA").cls("classB", "remove");

without patch (notice the space):

<p class="classA ">test</p>

with patch:

<p class="classA">test</p>
Contributor
tjk commented Jul 30, 2012

add also has the same issue as remove/replace. i'll try to produce a slightly more robust improvement...

@tjk tjk better contiguous spaces handling in class lists
stripping class attribute value for more cases
fdb567b
Contributor
tjk commented Jul 30, 2012

Squashed my commits. Although this is less ideal than a much more robust solution (duplicate adds don't continue to concatenate to class list, for instance), a more robust solution would involve quite a few more bytes...

@kylebarrow kylebarrow merged commit 3a9649b into kylebarrow:master Jul 30, 2012
Owner

Awesome, thanks.

Contributor
tjk commented Jul 30, 2012

Of course! Chibi's great, so thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment