Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

feat(jqLite): implement width() and height() #4078

Closed
wants to merge 1 commit into from

Conversation

caitp
Copy link
Contributor

@caitp caitp commented Sep 20, 2013

Target milestone: After 1.2 release.

These are fairly commonly used DOM manipulation methods, which are sorely missing from jqLite.

The implementations provided here are much simpler than jQuery's implementations, relying only on offsetWidth and offsetHeight, and performing no special operation for document elements or other special cases.

However, they do provide some basic essentials, and this is a good thing.

Also implemented in this patch: jqLite.css() will now leverage getComputedStyle if it is available, before relying on the inline style. This is necessary to provide a more robust means of determining whether or not an element is visible or not, which height()/width() need to know.

@mary-poppins
Copy link

Thanks for the PR!

  • Contributor signed CLA now or in the past
    • If you just signed, leave a comment here with your real name
  • PR's commit messages follow the commit message format

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@caitp
Copy link
Contributor Author

caitp commented Sep 20, 2013

Signed CLA as Caitlin Potter. We'll see if it actually matters, though :) I'm not too sure this sort of thing would be merged.

@btford
Copy link
Contributor

btford commented Sep 20, 2013

Thanks @caitp! I'm not entirely sure where we draw the line for what we're willing to add to jqLite, but this gets a +1 from me.

@marknadig
Copy link
Contributor

@btford was wondering if there were some guidelines around what will be considered for jqlite. Seems everyone's got their own favorites (was looking for select & focus today).

@caitp
Copy link
Contributor Author

caitp commented Oct 31, 2013

it's clear that not everything from jquery could be integrated, but I'd be interested in hearing where exactly the bar sits in terms of what is doable and what isn't, as well. I think a lot of the features which are appearing in PRs lately are generally pretty trivial, though

@btford
Copy link
Contributor

btford commented Oct 31, 2013

Ideally, we'd just use jQuery custom builds and you could include/exclude whatever features you wanted. Hopefully we'll be able to do this some time in the future. We briefly looked into it, but it's unfortunately not totally straightforward yet.

@marknadig
Copy link
Contributor

Thanks for the reply. I was thinking about this last night... If jqlite included only the API bits that angularjs used, it would provide an interesting bit of documentation. It gets muddy fast when APIs are added anticipating needs outside of the core. Today, people can create a custom jquery build on their own and have angular just use that.

I'm in a bit of a hard place in that I'm including angular 1.2 into an app that has jquery.reallyold, so I just force angular to use jqlite and so I am a bit restricted.

@caitp
Copy link
Contributor Author

caitp commented Oct 31, 2013

I'm not sure I like the idea of the "custom jQuery build" idea, because I would see this as being extremely difficult to support, and could cause all sorts of annoyance with the idea of using angular modules as "web components", but that's just my 2c.

It would be cool to have a build step which simply removes closures/code which is never referenced in the app, but I don't think it would really be a good idea to make this part of the development process itself (again, just my 2c)

@IgorMinar
Copy link
Contributor

I'm sorry, but I wasn't able to verify your CLA signature. CLA signature is required for any code contributions to AngularJS.

Please sign our CLA and ensure that the CLA signature email address and the email address in this PR's commits match.

If you signed the CLA as a corporation, please let me know the company's name.

Thanks a bunch!

PS: If you signed the CLA in the past then most likely the email addresses don't match. Please sign the CLA again or update the email address in the commit of this PR.
PS2: If you are a Googler, please sign the CLA as well to simplify the CLA verification process.

@IgorMinar
Copy link
Contributor

CLA signature verified! Thank you!

Someone from the team will now triage your PR and it will be processed based on the determined priority (doc updates and fixes with tests are prioritized over other changes).

@btford
Copy link
Contributor

btford commented Dec 10, 2013

👏

Provides a simple mechanism to query the pixel height and width of an element,
regardless of whether or not it is hidden in some fashion or not.

Additionally, jqLite.css() now leverages `getComputedStyle` if it is available.
@tamtakoe
Copy link

👍

Full set of properties (.height() .innerHeight() .outerHeight([includeMargin]), etc.) more useful because We can use offsetHeight/Width by native JS without height(), width(). But inner/outerHeight more difficult function and we need helpers

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants