@@ -99,6 +99,9 @@ extension DomHTMLDocumentExtension on DomHTMLDocument {
9999 external DomHTMLHeadElement ? get head;
100100 external DomHTMLBodyElement ? get body;
101101 external set title (String ? value);
102+ Iterable <DomElement > getElementsByTagName (String tag) =>
103+ createDomListWrapper <DomElement >(js_util
104+ .callMethod <_DomList >(this , 'getElementsByTagName' , < Object > [tag]));
102105}
103106
104107@JS ('document' )
@@ -124,6 +127,8 @@ extension DomEventTargetExtension on DomEventTarget {
124127 < Object > [type, listener, if (useCapture != null ) useCapture]);
125128 }
126129 }
130+
131+ external bool dispatchEvent (DomEvent event);
127132}
128133
129134typedef DomEventListener = void Function (DomEvent event);
@@ -220,6 +225,23 @@ extension DomElementExtension on DomElement {
220225 external void remove ();
221226 external void setAttribute (String name, Object value);
222227 void appendText (String text) => append (createDomText (text));
228+ external void removeAttribute (String name);
229+ external set tabIndex (int ? value);
230+ external int ? get tabIndex;
231+ external void focus ();
232+
233+ /// [scrollTop] and [scrollLeft] can both return non-integers when using
234+ /// display scaling.
235+ ///
236+ /// The setters have a spurious round just in case the supplied [int] flowed
237+ /// from the non-static interop JS API. When all of Flutter Web has been
238+ /// migrated to static interop we can probably remove the rounds.
239+ int get scrollTop => js_util.getProperty (this , 'scrollTop' ).round ();
240+ set scrollTop (int value) =>
241+ js_util.setProperty <num >(this , 'scrollTop' , value.round ());
242+ int get scrollLeft => js_util.getProperty (this , 'scrollLeft' ).round ();
243+ set scrollLeft (int value) =>
244+ js_util.setProperty <num >(this , 'scrollLeft' , value.round ());
223245}
224246
225247@JS ()
@@ -287,6 +309,10 @@ extension DomCSSStyleDeclarationExtension on DomCSSStyleDeclaration {
287309 set alignItems (String value) => setProperty ('align-items' , value);
288310 set margin (String value) => setProperty ('margin' , value);
289311 set background (String value) => setProperty ('background' , value);
312+ set touchAction (String value) => setProperty ('touch-action' , value);
313+ set overflowY (String value) => setProperty ('overflow-y' , value);
314+ set overflowX (String value) => setProperty ('overflow-x' , value);
315+ set outline (String value) => setProperty ('outline' , value);
290316 String get width => getPropertyValue ('width' );
291317 String get height => getPropertyValue ('height' );
292318 String get position => getPropertyValue ('position' );
@@ -342,6 +368,10 @@ extension DomCSSStyleDeclarationExtension on DomCSSStyleDeclaration {
342368 String get alignItems => getPropertyValue ('align-items' );
343369 String get margin => getPropertyValue ('margin' );
344370 String get background => getPropertyValue ('background' );
371+ String get touchAction => getPropertyValue ('touch-action' );
372+ String get overflowY => getPropertyValue ('overflow-y' );
373+ String get overflowX => getPropertyValue ('overflow-x' );
374+ String get outline => getPropertyValue ('outline' );
345375
346376 external String getPropertyValue (String property);
347377 void setProperty (String propertyName, String value, [String ? priority]) {
@@ -359,7 +389,6 @@ class DomHTMLElement extends DomElement {}
359389
360390extension DomHTMLElementExtension on DomHTMLElement {
361391 int get offsetWidth => js_util.getProperty <num >(this , 'offsetWidth' ) as int ;
362- external void focus ();
363392}
364393
365394@JS ()
@@ -927,11 +956,19 @@ class DomMouseEvent extends DomUIEvent {}
927956extension DomMouseEventExtension on DomMouseEvent {
928957 external num get clientX;
929958 external num get clientY;
959+ external num get offsetX;
960+ external num get offsetY;
961+ DomPoint get client => DomPoint (clientX, clientY);
962+ DomPoint get offset => DomPoint (offsetX, offsetY);
930963 external int get button;
931964 external int ? get buttons;
932965 external bool getModifierState (String keyArg);
933966}
934967
968+ DomMouseEvent createDomMouseEvent (String type, [Map <dynamic , dynamic >? init]) =>
969+ js_util.callConstructor (domGetConstructor ('MouseEvent' )! ,
970+ < Object > [type, if (init != null ) js_util.jsify (init)]);
971+
935972@JS ()
936973@staticInterop
937974class DomPointerEvent extends DomMouseEvent {}
@@ -947,6 +984,11 @@ extension DomPointerEventExtension on DomPointerEvent {
947984 this , 'getCoalescedEvents' , < Object > []).cast <DomPointerEvent >();
948985}
949986
987+ DomPointerEvent createDomPointerEvent (String type,
988+ [Map <dynamic , dynamic >? init]) =>
989+ js_util.callConstructor (domGetConstructor ('PointerEvent' )! ,
990+ < Object > [type, if (init != null ) js_util.jsify (init)]);
991+
950992@JS ()
951993@staticInterop
952994class DomWheelEvent extends DomMouseEvent {}
@@ -973,8 +1015,37 @@ class DomTouch {}
9731015
9741016extension DomTouchExtension on DomTouch {
9751017 external int ? get identifier;
976- external num ? get clientX;
977- external num ? get clientY;
1018+ external num get clientX;
1019+ external num get clientY;
1020+ DomPoint get client => DomPoint (clientX, clientY);
1021+ }
1022+
1023+ DomTouchEvent createDomTouchEvent (String type, [Map <dynamic , dynamic >? init]) =>
1024+ js_util.callConstructor (domGetConstructor ('TouchEvent' )! ,
1025+ < Object > [type, if (init != null ) js_util.jsify (init)]);
1026+
1027+ @JS ()
1028+ @staticInterop
1029+ class DomHTMLInputElement extends DomHTMLElement {}
1030+
1031+ extension DomHTMLInputElementExtension on DomHTMLInputElement {
1032+ external set type (String ? value);
1033+ external set max (String ? value);
1034+ external set min (String value);
1035+ external set value (String ? value);
1036+ external String ? get value;
1037+ external bool ? get disabled;
1038+ external set disabled (bool ? value);
1039+ }
1040+
1041+ DomHTMLInputElement createDomHTMLInputElement () =>
1042+ domDocument.createElement ('input' ) as DomHTMLInputElement ;
1043+
1044+ class DomPoint {
1045+ final num x;
1046+ final num y;
1047+
1048+ DomPoint (this .x, this .y);
9781049}
9791050
9801051Object ? domGetConstructor (String constructorName) =>
0 commit comments