Skip to content

Fixing the return type of outerHeight and outerWidth #16

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

Merged
merged 3 commits into from
Aug 2, 2018

Conversation

cdejemeppe
Copy link
Contributor

According to the documentation of JQuery, starting from JQuery 3.0, both methods outerHeight and outerWidth return undefined when called on an empty set of elements.
Before version 3.0, it returned null.

For this reason, I propose to change the return type of both outerWidth and outerHeight to js.UndefOr[Double] instead of Double.

@Starzu
Copy link
Contributor

Starzu commented Aug 2, 2018

Hi @cdejemeppe. You are right, I've overlooked this change.

In this wrapper we try to hide types from Scala.js, so you should remove these methods from JQuery trait and implement them in JQueryWrapper class around line 1147 of the same file.

Something like that:

/** Get the current computed height for the first element in the set of matched elements, including padding,
  * border, and optionally margin. Returns a number (without "px") representation of the value or undef
  * if called on an empty set of elements. <br/>
  * See: <a href="http://api.jquery.com/outerHeight/">jQuery Docs</a> */
def outerHeight(includeMargin: Boolean = false): Option[Double] =
  jquery.asInstanceOf[js.Dynamic].outerHeight(includeMargin).asInstanceOf[UndefOr[Double]].toOption

@Starzu Starzu self-requested a review August 2, 2018 09:14
@cdejemeppe
Copy link
Contributor Author

Hi @Starzu,

Thank you for the quick answer. I have made changes according to your suggestion.

@Starzu
Copy link
Contributor

Starzu commented Aug 2, 2018

@cdejemeppe Could you also remove the original methods from JQuery trait?

@Starzu
Copy link
Contributor

Starzu commented Aug 2, 2018

Thanks @cdejemeppe. I'll publish new version tommorow.

@Starzu Starzu merged commit f1e325e into UdashFramework:master Aug 2, 2018
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.

2 participants