elemental2: Document.createEvent ?

475 views
Skip to first unread message

Vassilis Virvilis

unread,
Aug 9, 2019, 10:21:23 AM8/9/19
to google-we...@googlegroups.com
Hi,

I am looking for Document.createEvent and I can see that createEvent
is defined in DocumentEvent which is an interface but Document itself
does not inherit/implement this interface.

I suppose I can cast Document it to DocumentEvent with Js.cast() but
that's ugly.

So what's going on?

I am using elemental2 2.25 as published by Peter Donald.

--
Vassilis Virvilis

Vassilis Virvilis

unread,
Aug 9, 2019, 10:54:59 AM8/9/19
to google-we...@googlegroups.com
What about Document.execCommand() ?
--
Vassilis Virvilis

Peter Donald

unread,
Aug 11, 2019, 1:32:17 AM8/11/19
to GWT Mailing List
execCommand is not yet part of elemental2. There is no reason why it should not be other than the externs need cleaning up. It is on my list of things to do some time but we don't use it so I haven't got off my kaboose to do the work. The issue that is tracking this (among other things) is https://github.com/google/elemental2/issues/86

Until that is completed you will have to use jsinterop to do it yourself.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/CAKbOjEx4%2B3TZuMJf2%3DBiCW6d57o-OLoMiBjqjSi%3DMjPny%2B%2B_ug%40mail.gmail.com.


--
Cheers,

Peter Donald

Vassilis Virvilis

unread,
Aug 11, 2019, 3:26:01 AM8/11/19
to google-we...@googlegroups.com
Hi Peter,

Thanks for replying and for pointing me to the github issue.

I am thinking the following strategy.

Create a MyHTMLDocument that extends HTMLDocument and it has the
execCommand but without the @Override annotations.

That way when HTMLDocument gets execDocument implemented I will get a
warning and at that point I will be able to remove the MyHTMLDocument
class and use the official one. Aargh now I see that is already
mentioned in the comments of the original execCommand issue at
https://github.com/google/elemental2/issues/43 by vegegoku.

Thanks again.

Vassilis
> To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/CACiKNc4frwwFenqaAGPN3nBxgsYHJ_gO_86QbOPQpBT02eySsg%40mail.gmail.com.



--
Vassilis Virvilis

Vassilis Virvilis

unread,
Aug 12, 2019, 8:40:06 AM8/12/19
to google-we...@googlegroups.com
Hi again,

I did create a class MyHTMLDocument that extends HTMLDocument.

However

final MyHTMLDocument doc = Js.cast(DomGlobal.document); <-- this crashes
final MyHTMLDocument doc = Js.uncheckedCast(DomGlobal.document); <-- this works

any idea why uncheckedCast is required?

Thanks

Vassilis Virvilis
--
Vassilis Virvilis

Jens

unread,
Aug 12, 2019, 9:27:19 AM8/12/19
to GWT Users

final MyHTMLDocument doc = Js.cast(DomGlobal.document);  <-- this crashes
final MyHTMLDocument doc = Js.uncheckedCast(DomGlobal.document);  <-- this works

Because the native browser document isn't a MyHTMLDocument? You can only treat it like a MyHTMLDocument by doing a nasty unchecked cast so you can call that method you need.

-- J.

Vassilis Virvilis

unread,
Aug 13, 2019, 8:17:33 AM8/13/19
to google-we...@googlegroups.com
It would be great if there was some documentation that could compare
and spell the differences between
standard cast (), Js.cast(), Js.uncheckedCast() in various use cases
so we could have a list of dos and donts.

Vassilis
> --
> You received this message because you are subscribed to the Google Groups "GWT Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/de0c434d-6ed6-4205-b674-0aaf697110a0%40googlegroups.com.



--
Vassilis Virvilis

Jens

unread,
Aug 14, 2019, 2:58:10 AM8/14/19
to GWT Users

It would be great if there was some documentation that could compare
and spell the differences between
standard cast (), Js.cast(), Js.uncheckedCast() in various use cases
so we could have a list of dos and donts.

Vassilis Virvilis

unread,
Aug 14, 2019, 3:37:26 AM8/14/19
to google-we...@googlegroups.com
Jens,

Thanks for reminding me. I have totally forgot this section.

I believe that the document was written before Js.cast and Js.unchecked cast.

Maybe some use cases and some examples would be helpful.

Thanks again.
> --
> You received this message because you are subscribed to the Google Groups "GWT Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/e89fdeec-6bfd-48d3-973a-a98f4287d83b%40googlegroups.com.



--
Vassilis Virvilis
Reply all
Reply to author
Forward
0 new messages