bitnick
bitnick

Reputation: 2073

How to access contentDocument of object element in Dart 2.0?

<object data="abc.svg" width="100" height="100" type="image/svg+xml"></object>

I want get the content of the svg,in javascript,it can be get by obj.contentDocument,how to do this in dart?

Upvotes: 2

Views: 137

Answers (1)

Dafe Šimonek
Dafe Šimonek

Reputation: 351

It seems that you'll have to use JsObject.fromBrowserObject:

<object id="svgImage" data="abc.svg" width="100" height="100" type="image/svg+xml"></object>

ObjectElement svgImage = querySelector('#svgImage'); 
var contentDoc = new js.JsObject.fromBrowserObject(svgImage)['contentDocument'];

For details see discussion in other SO thread Extending <object> in Dart

Upvotes: 1

Related Questions