Closed jiakuan closed 9 months ago
These are defined in gecko_dom
extern so it would be solved by https://github.com/google/elemental2/issues/86 or by moving standard definitions from gecko_dom
to the default extern as suggested in https://github.com/google/closure-compiler/issues/2478
@jDramaix Given reluctance in closure compiler to move them; maybe we should just include gecko_dom. Are they any negatives to that?
One downside of including gecko_dom as is that it would expose many non-standard or nonexistent APIs, e.g. Element.prototype.firebugIgnore
, Window.prototype.controller
, ...
I think it would be nice to not clutter Elemental2 with all those deprecated APIs, so I created a PR for closure compiler instead: https://github.com/google/closure-compiler/pull/4102
Similarly, most properties are missing in TextMetrics
except width
being there.
As a temporary workaround, I created a new type to use:
import elemental2.dom.TextMetrics;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsType;
@JsType(isNative = true, name = "TextMetrics", namespace = JsPackage.GLOBAL)
public class TextMetrics2 extends TextMetrics {
public double actualBoundingBoxAscent;
public double actualBoundingBoxDescent;
public double actualBoundingBoxLeft;
public double actualBoundingBoxRight;
public double fontBoundingBoxAscent;
public double fontBoundingBoxDescent;
}
https://github.com/google/closure-compiler/blob/master/externs/browser/html5.js#L989 already has most of these so they should be included in next elemental release. The remaining ones (fontBoundingBoxAscent/fontBoundingBoxDescent) are not yet supported in FireFox.
I double checked and all missing api are now part of Elemental2. A new release is needed though.
Some important properties such as
selectionStart
andselectionEnd
are missing inelemental2.dom.HTMLTextAreaElement
.https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement