Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: support Dart from within SVG document #2203

Closed
DartBot opened this issue Mar 16, 2012 · 10 comments
Closed

Feature Request: support Dart from within SVG document #2203

DartBot opened this issue Mar 16, 2012 · 10 comments
Labels
type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented Mar 16, 2012

This issue was originally filed by mikeeberhar...@gmail.com


I would like to use Dart in a standalone SVG document
by including a script, like...
 <script type="application/dart" xlink:href="myapplication.dart"/>

...and then having my SVG onload= event launch "main()" in my Dart-
code, without the SVG requiring an outer HTML file to work.

I currently use JavaScript from within SVG documents like this for full "applications" that are ONLY an SVG document (i.e., no wrapping HTML) with embedded JavaScript, like this example (runs in Chrome):
http://www.mv4t.com/SVG/SVG_Components_Demo.svg

I would really like to convert my SVG JS code to Dart.

@iposva-google
Copy link
Contributor

Removed Type-Defect label.
Added Type-Enhancement, Area-Dartium, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Mar 20, 2012

This comment was originally written by antonm@google.com


Mike,

may you small example which fails for you?

tia and yours,
anton.

@DartBot
Copy link
Author

DartBot commented Mar 20, 2012

This comment was originally written by mikeeberhar...@gmail.com


I attached what I hope is a simple example.
Dartium 19.0.1071.0 (Developer Build 127096 Windows) is what I tested this on.

The SVG has an onload=main() that successfully runs code in a JavaScript file (that has been included by <script> tag) fine, but there is no apparent way to get the SVG onload to fire a DART program because Dartium apparently is unaware of how to process any <script> for DART language.

Dartium crashes on script syntax like <script type="application/dart" xlink:href="external-code.dart"/> or "text/dart", for both inline dart code or externally-referenced dart code (using xlink:href) like this.

I did not include a .dart file equivalent to the JS code, as it is irrelevant... Dartium can not find ANY .dart file referred to from within SVG, from what I can tell. A single-line external-code.dart file with "main(){}" would suffice for testing.

I hope this helps clarify.


Attachments:
SVG-using-external-JS.svg (1.28 KB)
external-code.js (960 Bytes)

@DartBot
Copy link
Author

DartBot commented Mar 20, 2012

This comment was originally written by antonm@google.com


Thank you very much, Mike, most appreciated.


Set owner to antonm@google.com.
Added Accepted label.

@DartBot
Copy link
Author

DartBot commented Mar 26, 2012

This comment was originally written by antonm@google.com


Mike,

we decided not to support inline callbacks. So your code should be structured differently. And note as well that already main method is invoked on DOMContentLoaded event, so you do need this onload thing anyway.


Added NeedsInfo label.

@DartBot
Copy link
Author

DartBot commented Mar 26, 2012

This comment was originally written by mikeeberh...@gmail.com


antonm...
I tried to make sense of what you just posted for comment #­5, but cannot.
Did you perhaps forget a word?

  You said: "...so you do need this onload thing anyway"
  Did you really mean "so you do NOT need this onload thing anyway"?

Next, you said "we decided not to support inline callbacks".
OK, fine. But, can I still assume you are going to make Dartium able to recognize and run a script of type dart with an SVG file, as I originally asked?

  e.g., <script type="application/dart" xlink:href="myapplication.dart"/>

If this will be supported, and if Dartium will load that script and run "main()" therein by default as you said, that is fine by me.

@DartBot
Copy link
Author

DartBot commented Mar 28, 2012

This comment was originally written by antonm@google.com


Mike, sorry, my wording was far from perfect.

Yes, I meant 'so you do not need this onload thing anyway'. And yes, I am fixing Dartium to support SVG documents. ETA is tomorrow my time (MSK).


Added Started label.

@DartBot
Copy link
Author

DartBot commented Mar 29, 2012

This comment was originally written by antonm@google.com


Mike,

I hope I've fixed at least the immediate problem.


Added Fixed label.

@DartBot
Copy link
Author

DartBot commented Mar 31, 2012

This comment was originally written by mikeebe...@gmail.com


antonm...
Thank you!
Yes, I can now use Dart scripts directly from within an .SVG document when viewing with the latest build of Dartium. My early tests function as expected.

In fact, now that I could use Dart, I rewrote the pseudo-examples from my Comment #­3 (above), and have attached a working Dart equivalent: example SVG referencing an external .dart file, which contains main() that fires on content load... it does some simple mouse-event-interaction with the displayed Rect object. Just in case anyone wanted to see the new native-Dart version in action.


Attachments:
SVG-using-external-Dart.svg (720 Bytes)
external-code.dart (1011 Bytes)

@DartBot
Copy link
Author

DartBot commented Apr 2, 2012

This comment was originally written by antonm@google.com


I am glad to hear it and thanks a lot for very detailed bug report. Please, let us know if you meet any other problems.

@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
dart-bot pushed a commit that referenced this issue Oct 29, 2019
Includes the following commits:
80ac76400ff58fde3c5a335d860d196c3febe837 Warn about authors field in pubspec.yaml
6b6e02fcdd8094ccbba919b2fdc74947b1cebb71 Warn about old flutter plugin registration format (#2233)
8308acbc48ebd4da4ab7f45169af8dee4df18e79 Language versioning
b18d4f6a5d035f4f72ef187e9cdb133d18848c2d update doc
408bdd58ab01689fd82cc036b4142f7b592b4ba0 Added utility for faster local testing (#2235)
055fc19d2e06e819dbd47b3b56909c47bd893f66 Upgraded package:yaml to 2.2.0 (#2237)
0f3baf7abb13702f7fb1ff3709c584065df1435c Remove unused Map `availableVersions`
cfa9dc760b6b601f9473e65d15f15b60a319336d Fix to show proper error message when git is not installed (#2209)
d99b0d58f4059d7bb4ac4616fd3d54ec00a2b5d4 Rephrase warnings for missing deps (#2203)
76b8c30395b37f96d3db3e842344cc842bdd7c24 Don't mention 'transformed dependencies'. (#2199)
4bd65e0f54e6e4540f03467b0272a5666e8d54ba return the hashCode of the description (#2198)
92b52682e8fc6eed9ef2e77ed890647f75570165 Test more pre-release behavior. (#2175)
066ac118d406500f672339e25f0154af9321deac update to latest pkg:analyzer (#2172)
289804a5d2c9746b4e86c271c2abcfe17417e20f Minor typo fixed (#2166)

Change-Id: I3922bcaacb5399853a291b92d7192d21f719d224
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123404
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
copybara-service bot pushed a commit that referenced this issue Sep 8, 2023
Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (https://github.com/dart-lang/dartdoc/compare/a32ba3a..adc76e6):
  adc76e6d  2023-09-06  Parker Lougheed  Take advantage of a few Dart 3 features (#3491)

leak_tracker (https://github.com/dart-lang/leak_tracker/compare/098bafc..4616c8b):
  4616c8b  2023-09-05  Polina Cherkasova  Note about OverlayEntry. (#142)
  fd7d70f  2023-09-01  dependabot[bot]  Bump actions/checkout from 3.5.3 to 3.6.0 (#141)
  c6c1004  2023-09-01  Polina Cherkasova  - (#139)
  0298e20  2023-08-31  Polina Cherkasova  Add a test specific rule. (#138)
  ea17fa4  2023-08-29  Polina Cherkasova  Increase version of leak_tracker_flutter_testing (#136)
  8f830d6  2023-08-29  Polina Cherkasova  Update pubspec.yaml (#135)
  8a54575  2023-08-29  Polina Cherkasova  Enable connection to vm service for flutter testing and define matcher for reporting for memory
allocations. (#128)
  88a19a7  2023-08-28  Polina Cherkasova  - (#133)
  2070856  2023-08-24  Polina Cherkasova  Add instruction to start tracking instances of ChangeNotifier earlier. (#130)
  eb6113a  2023-08-23  Polina Cherkasova  Measure how memory is consumed by a test. (#114)
  72264f7  2023-08-22  Polina Cherkasova  Fix misspelling. (#131)
  87c9e9e  2023-08-16  Polina Cherkasova  Add debugging construcstors to LeakTrackingTestConfig, per leak type. (#129)
  b29547a  2023-08-15  Polina Cherkasova  Create visibility for roadmap for leak_tracker. (#124)
  23b15b6  2023-08-15  Polina Cherkasova  Fix issue of using wrong settings for a phase. (#122)
  713f646  2023-08-11  Polina Cherkasova  Enable global configuration for leak tracking. (#121)
  19b01cf  2023-08-10  Polina Cherkasova  Create package leak_tracker_flutter_testing. (#119)
  02d0b2f  2023-08-07  Polina Cherkasova  Stop failing if object is disposed twice. (#117)
  2026379  2023-08-04  Polina Cherkasova  Remove not-published versions and increase leak_tracker version. (#116)
  9bb71c6  2023-08-04  Polina Cherkasova  Stop requiring registration of disposed objects. (#113)
  8939456  2023-08-04  Polina Cherkasova  Refactor dispatcher. (#115)
  6f54f5a  2023-08-01  Polina Cherkasova  Start vm service when needed. (#112)
  b045c5e  2023-08-01  Polina Cherkasova  Reorganize leak tracker for better performance. (#106)
  127b83c  2023-07-31  Polina Cherkasova  Update TROUBLESHOOT.md (#108)
  6dabd33  2023-07-31  Polina Cherkasova  Simplify and clarify instructions to fix leaks. (#107)
  c53db68  2023-07-25  Polina Cherkasova  Improve code structure. (#103)
  10cce1a  2023-07-24  Polina Cherkasova  Rename `gcCountBuffer` to `numberOfGcCycles`. (#101)
  3a061a4  2023-07-21  Polina Cherkasova  Improve doc comments. (#100)
  6e3f57c  2023-07-21  Polina Cherkasova  Fix and test cover case of customized `gcCountBuffer` (#99)
  2152aab  2023-07-21  Polina Cherkasova  Add details about hidden leaks. (#97)

lints (https://github.com/dart-lang/lints/compare/da44af3..8d5f750):
  8d5f750  2023-09-06  Devon Carew  move the list of lint rules from the readme to a separate rules.md file (#145)

native (https://github.com/dart-lang/native/compare/a2dfedc..387f894):
  387f894  2023-09-06  Gabriel Terwesten  [native_toolchain_c] Default handling for PIC/PIE compiler flags (#121)
  0a4e5f8  2023-09-06  Gabriel Terwesten  Add support for defines to `CBuilder` (#120)

webdev (https://github.com/dart-lang/webdev/compare/fc876cb..9487a45):
  9487a459  2023-09-05  Jacob Bang  Update README.md to use `dart pub` instead of `pub` (#2195)
  07367779  2023-08-31  Elliott Brooks  Pass the package config directly to the load strategy instead of depending on an app entrypoint
(#2203)
  0044d753  2023-08-24  Jonas Termansen  Fix conflicting webdev smoke package names. (#2202)
  6183f270  2023-08-23  Elliott Brooks  Allow client to specify a way to convert an absolute path into a g3-relative path (#2200)
  b244b899  2023-08-22  Elliott Brooks  Allow client to specify how to find the package config  (#2199)

Change-Id: Ic00adc68ec01cd0cc6e27be665436de5095d8d07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324801
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants