Skip to content
This repository has been archived by the owner on Jan 24, 2018. It is now read-only.

Update for easing function names regexp #533

Merged
merged 2 commits into from
Jun 8, 2014
Merged

Conversation

slidych
Copy link
Contributor

@slidych slidych commented Jun 6, 2014

A tiny update that fixes the bug when trying to apply easing function on attribute animation. Current regexp works fine when you use something like "left[outCubic]: 50px" but fails on "@data-num[outCubic]: 100".

A tiny update that fixes the bug when trying to apply easing function on attribute animation. Current regexp works fine when you use something like "left[outCubic]: 50px" but fails on "@data-num[outCubic]: 100".
@@ -70,7 +70,7 @@
var rxPropValue = /\s*(@?[\w\-\[\]]+)\s*:\s*(.+?)\s*(?:;|$)/gi;

//Easing function names follow the property in square brackets.
var rxPropEasing = /^([a-z\-]+)\[(\w+)\]$/;
var rxPropEasing = /^([a-z\-@]+)\[(\w+)\]$/;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think /^@?([a-z\-]+)\[(\w+)\]$/; would be even more concise?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, this wouldn't work. When you run this regexp on a string like @data-animate[easing]: 100 the result would be:
["@data-animate[easing]", "data-animate", "easing"]
Instead of:
["@data-animate[easing]", "@data-animate", "easing"]

And the @ is required there because you use it then as a name of a property to animate. And you need it to check if it's an attribute or a style.

Although, it could be /^(@?[a-z-]+)[(\w+)]$/. But the result is quite the same.

Prinzhorn added a commit that referenced this pull request Jun 8, 2014
Update for easing function names regexp
@Prinzhorn Prinzhorn merged commit fa9f5fe into Prinzhorn:master Jun 8, 2014
@Prinzhorn
Copy link
Owner

Thanks, released as 0.6.26

@slidych slidych deleted the patch-1 branch June 8, 2014 18:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants