Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pauseResume): Fix a script error on stop() #276

Merged
merged 2 commits into from
Jul 6, 2016

Conversation

jongmoon
Copy link
Contributor

@jongmoon jongmoon commented Jul 1, 2016

Issue

#274

Details

When you call stop() on elements which is not animated,
script error occurs because __aniProp is not exist.

Preferred reviewers

@naver/egjs-dev

When you call it on elements which is not animated,
script error occurs because __aniProp is not exist.

Ref naver#274
@jongmoon jongmoon mentioned this pull request Jul 1, 2016
@sculove
Copy link
Contributor

sculove commented Jul 1, 2016

LGTM

@jongmoon jongmoon self-assigned this Jul 1, 2016
@taihoon
Copy link

taihoon commented Jul 5, 2016

LGTM 2

@@ -10,13 +10,46 @@ QUnit.config.reorder = false;
var hooks = {
beforeEach: function() {
this.$el = $("#box1");
this.$el.each(function() {
Copy link
Member

Choose a reason for hiding this comment

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

it can be silly question, but $el is referring an element which has id. Assuming that, $el.each doesn't make sense, considering $el is an element not array.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@netil Yes, you right!
But as you know, we should handle element as array item no matter how many it has.

So in any case we need to access that element using array style.
But I didn't want to access an element by [0] like below. It looks hard-corded.

  delete $el[0].__aniProps;

Copy link
Member

Choose a reason for hiding this comment

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

The way of handling will dependent of data types. So if we're handling array is ok using array methods, but if we handle non array values is quite considerable use non array method for that.

In my opinion for that case I'd write like:

this.$el = $("#box1");
delete this.$el.get(0).__aniProps;

// but, also below one is ok
delete $el[0].__aniProps;

But, it's not a big deal issue. It's ok what is written now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@netil I agree with you in this context. Thank you for review!

skip: apply review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants