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
Add useful things from jQuery #8376
Comments
cc @efortuna. |
Kevin Moore has implemented some of the effects for widget.dart: |
This comment was originally written by ladicek@gmail.com At least the add/remove/toggle/hasClass is already there -- the Element class contains a set (which is actually a Set, so a normal collection!) of CSS classes called 'classes'. Normal Set wouldn't need a 'toggle' method, but this one does -- and it's there. Also, the offset* seem to already be there, but maybe they are different than in jQuery, I can't tell. |
This comment was originally written by yohan.b...@gmail.com
And I'm wondering, if couldn't have some kind of facade methods in Element.
Offset offset = query('#foo').offset() seems better than Element element = query('#foo'); But again it's just my personal opinion. Moreover, the jQuery method allow you to pass an object ".offset({ top: 10, left: 30 })" or a function "offset( function(index, coords))", to move an element.
|
We added Element.append() which is a shortcut for Element.children.add(), not opposed to additional shortcuts. But .addClass doesn't seem to buy much beyond .classes.add(). CssClassSet APIs which support sets of tags rather than single tags seems logical, though a bit odd since its overriding Set functions. I think we should get this in. For the offset APIs, I want Point and Rect classes in Dart (I renamed dart:html's webkit-only Point class to DomPoint to make way for it), but there's some discussion about where they should live- in dart:html or elsewhere (I prefer elsewhere, specifically dart:math). Once we have the Point class, we should also have APIs for relative positioning between elements and events. As far as I'm concerned, getting proper Point & Rect classes is the blocking pre-req for this. Good discussion, I'm going to break out specific items and at some point close this bug as invalid (too many divergent issues), but feel free to continue to append to it and we can fork as needed. So far I've opened: The effects/animation ones are definitely useful, but for now I'd prefer to have those in a separate package. |
This comment was originally written by yohan.b...@gmail.com If you are interested I implemented few features (What I needed in fact) |
Added this to the M4 milestone. |
This comment was originally written by amouravski@google.com Issue #6526 has been merged into this issue. |
This comment was originally written by amouravski@google.com Issue #4144 has been merged into this issue. |
Set owner to @efortuna. |
cc @blois. |
Issue #6526 has been merged into this issue. |
It seems that jQuery's innerHeight is the same as clientHeight. Is this actually the case? If so, how do we merge this new functionality with what's already available on Element? See discussion on web-ui mailing list for more details https://groups.google.com/a/dartlang.org/d/msg/web-ui/hV0EwPVeWvE/INUVX9IMVMgJ |
Removed this from the M5 milestone. |
This comment was originally written by danny@kirchmeier.us I am very interested in seeing 'toggleClass(className, switch)' implemented in dart in some way. I abhor having to write this code: if(foo) e.classes.add('myStyle'); and would rather write: e.classes.toggle('myStyle', foo); |
This comment was originally written by @sethladd Thanks for the suggestion. Turns out there's an API for it: http://api.dartlang.org/docs/releases/latest/dart_html/CssClassSet.html#toggle I think you can use it like: query('#elem').classes.toggle('myStyle'); Give that a try, let us know. Thanks! |
This comment was originally written by @seaneagan I agree toggling classes via a boolean value is useful. I filed issue #11741 for that. |
Toggling via boolean value has been added. Also just checked in https://codereview.chromium.org//19786005 at r25235 which provides functionality for all the innerHeight/outerHeight/height measurements (but hopefully in a more straightforward Dart-y way). More to come. |
This issue was originally filed by yohan.bes...@gmail.com
Here is a list of functions from jQuery I find useful and that are missing from Dart (or that I'm not aware of).
These functions should be methods of the class Element :
CSS/Dimensions/Offset
Effects/Animation
The text was updated successfully, but these errors were encountered: