JqEltsIterator.hx 476 B

123456789101112131415161718192021
  1. package js.jquery;
  2. class JqEltsIterator {
  3. var j:JQuery;
  4. var i:Int;
  5. inline public function new(j:JQuery):Void {
  6. this.i = 0;
  7. this.j = j;
  8. }
  9. inline public function hasNext():Bool {
  10. return i < j.length;
  11. }
  12. inline public function next():JQuery {
  13. return new JQuery(this.j[i++]);
  14. }
  15. static function __init__() {
  16. if (untyped __typeof__(JQuery) != "undefined" && JQuery.fn != null)
  17. JQuery.fn.elements = function() return new JqEltsIterator(js.Lib.nativeThis);
  18. }
  19. }