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

bugfix: getClassName function fail if rootElement is not defined #27

Closed
wants to merge 1 commit into from

Conversation

cstoquer
Copy link
Contributor

Got this problem: If a non initialised wuiDom try to call getClassNames then an exception is thrown.

Fix: we check if rootElement exist, and if not, getClassNames will return an empty array (non initialised wuiDom have no class)

@ronkorving
Copy link

You would probably have to add this test to a dozen other APIs then too.
Now, I don't like exceptions of the "foo of undefined" style. But trying to set a className on something that doesn't exist is either:

  • a bad idea -> give me a useful error, don't ignore the call silently.
  • an early "setup" of DOM that is going to be initialized (in which case, the moment you assign DOM it should get that class name).

What do you think?

@cstoquer
Copy link
Contributor Author

+1 for the first point.
i figured out what was the source of the problem.
closing this PR.

@cstoquer cstoquer closed this Jul 10, 2014
@ronkorving
Copy link

Apologies for confusing your request with setClassNames by the way.

@micky2be
Copy link
Member

Not sure if it's related to your problem but we should remove #assign all together.
And create an error on the WuiDom instantiation if the first argument is missing.

A near future version will probably output warnings for the #assign users.

@cstoquer cstoquer deleted the fix/getClassName branch December 18, 2014 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants