elemental2: Document.createEvent ?

已查看 475 次
跳至第一个未读帖子

Vassilis Virvilis

未读,
2019年8月9日 10:21:232019/8/9
收件人 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

未读,
2019年8月9日 10:54:592019/8/9
收件人 google-we...@googlegroups.com
What about Document.execCommand() ?
--
Vassilis Virvilis

Peter Donald

未读,
2019年8月11日 01:32:172019/8/11
收件人 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

未读,
2019年8月11日 03:26:012019/8/11
收件人 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

未读,
2019年8月12日 08:40:062019/8/12
收件人 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

未读,
2019年8月12日 09:27:192019/8/12
收件人 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

未读,
2019年8月13日 08:17:332019/8/13
收件人 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

未读,
2019年8月14日 02:58:102019/8/14
收件人 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

未读,
2019年8月14日 03:37:262019/8/14
收件人 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
回复全部
回复作者
转发
0 个新帖子