Skip to content

dart:html should be split-up #3108

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

Closed
DartBot opened this issue May 17, 2012 · 10 comments
Closed

dart:html should be split-up #3108

DartBot opened this issue May 17, 2012 · 10 comments
Assignees
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-enhancement A request for a change that isn't a bug web-libraries Issues impacting dart:html, etc., libraries
Milestone

Comments

@DartBot
Copy link

DartBot commented May 17, 2012

This issue was originally filed by @seaneagan


The dart:html library is huge. This leads to some issues:

* makes the documentation extremely difficult to navigate

  • importing dart:html really clutters your namespace
  • prefixes must be used on top-level names in dart:html to avoid
    conflicts with other parts of the library
  • if it is not split up now, it will only get bigger over time

It should be split up into smaller libraries. The challenge of course
is where to draw the boundaries for the smaller libraries. Here are
some approximate subsets which should probably be their own library:

SVG* (154 names!)

Audio* (21 names)

CSS* (18 names)

IDB* (18 names)

WebGL* (17 names)

Worker (13 names)

Speech* (12 names)

typed arrays (11 names)
 see https://developer.mozilla.org/en/JavaScript_typed_arrays

Canvas* (5 names)

geometry
  see issue #3107

@sethladd
Copy link
Contributor

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

@rakudrama
Copy link
Member

Issue #3949 has been merged into this issue.

@rakudrama
Copy link
Member

Concerns from Issue #3949 which has been merged into this issue:

"""
Reported by fedor.korotkov, Yesterday (26 hours ago)
Currently there is a one huge file html_dartium.dart(1192 classes) that contains generated html stubs.

It would be great if you group some classes and extract them to separate files.

Comment 1 by rbeeger, Yesterday (25 hours ago)
Fedor's main motivation for this report is most likely that it takes some time for the IDEA Dart plugin to parse this file when it is opened.

But there is one more reason for splitting up this file. Separating it into several files based on the topic would help exploration of this part of dart's SDK.

So if I were interested in WebGL I would look into webgl.dart. For SVG I would look into svg.dart.
"""

I don't think we will be able to achieve much tool speedup by partitioning the library.
One motivation of partitioning dart:html is to exclude SVG* from the namespace.

Consider this is valid code fragment:
   var element = document.body;
   element.innerHTML = createAString();
   var innerElement = element.query('#Bob');
   print(innerElement.height);

createAString() could contain almost anything, including an SVGRectElement, e.g.
'<svg><rect id="Bob">...</rect>...</svg>'

The compiler needs to know that .height could be returning an SVGAnimatedLength (SVGRectElement.height) as well as a number (ImageElement.height) or String (TableCellElement.height).

In order for this to happen, all the SVG* names need to be available to the compiler, otherwise the compiler could make the incorrect inference that only strings and numbers could be returned and generate 'optimized' code that does not work.
In order for the compiler to generate correct code, a partitioned library would be implemented as a set of libraries that each re-export a subset of the current monolithic library. This does not get rid of the need to parse the whole monolithic library.

Since we don't want the editor to be inconsistent with the library, it consumes the same version of the library as the compiler, so would still need to parse all 500+ interfaces.

The in-editor experience would still be better since the editor can choose suggestions on the basis of names reachable from the imports rather than available on all instances reaching that point in the code.

@DartBot
Copy link
Author

DartBot commented Jul 2, 2012

This comment was originally written by [email protected]


In my case it take a few seconds to find all implementations for each class in that file. I will fix it but the main reason for me as a developer is impossibility to work with such file even in text editor. For example I can't look at both WebGL and geometry at the same time. Or simple navigation becomes uncomfortable.

@vsmenon
Copy link
Member

vsmenon commented Jul 11, 2012

cc @rakudrama.
Added this to the M1 milestone.

@iposva-google
Copy link
Contributor

Removed Area-DOM label.
Added Area-HTML label.

@vsmenon
Copy link
Member

vsmenon commented Aug 15, 2012

Removed this from the M1 milestone.
Added this to the Later milestone.
Removed Priority-Medium label.
Added Priority-High label.

@blois
Copy link

blois commented Oct 15, 2012

Removed this from the Later milestone.
Added this to the M2 milestone.

@blois
Copy link

blois commented Nov 1, 2012

Set owner to @blois.
Added Accepted label.

@blois
Copy link

blois commented Dec 5, 2012

SVG, Audio and Indexed DB have all been broken out. I'm hesitant to break CSS apart from HTML as the scenarios seem inseparable.

I'd like to treat breaking out anything else as separate issues. Note that breaking out WebGL is under consideration, but right now none of the others are.

Note that another one which we should consider is RTC as well.


Added Fixed label.

@DartBot DartBot added Type-Enhancement P1 A high priority bug; for example, a single project is unusable or has many test failures web-libraries Issues impacting dart:html, etc., libraries labels Dec 5, 2012
@DartBot DartBot added this to the M2 milestone Dec 5, 2012
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-enhancement A request for a change that isn't a bug web-libraries Issues impacting dart:html, etc., libraries
Projects
None yet
Development

No branches or pull requests

7 participants