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

Printing a TableSectionElement will print "[Instance of HTMLTableSectionElement]" #6645

Closed
floitschG opened this issue Nov 10, 2012 · 12 comments
Labels
P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@floitschG
Copy link
Contributor

According to the doc and to the editor the type is called "TableSectionElement", but when I print it, it shows up as HTMLTableSectionElement. ("Instance of 'HTMLTableSectionElement'").

@rakudrama
Copy link
Member

You could think of it as a subclass (even though it is not).
There is no way to tell, given "x is TableSectionElement", that x is not some subtype with the name HTMLTableSectionElement.

The alternative is to introduce a map for the names, >500 entries x 50 bytes = 25k of bloat per download. Or defining >500 toString methods for a similar cost.

In the future we may have ambiguity. Image there is a html library and an svg library.
Both could have an Element type that, it appears, you would like to print as "Instance of 'Element'".
It is probably better to keep the original DOM tags as names since the are unique.

Pete: this is one more consideration with the dart:html split.


cc @blois.

@rakudrama
Copy link
Member

Perhaps it should print as "<thead>" "<body>" or "<tfoot>".
It would not be too costly to make elements print as their tag.

@floitschG
Copy link
Contributor Author

Just to explain why this came up for me: I was writing an extension and since I'm really bad with HTML I printed the nodes that I got from the existing page. I then wanted to find the documentation for them. Without the correct name this becomes a guessing game.

@blois
Copy link
Contributor

blois commented Nov 12, 2012

The node type would work, but would be a further indirection from our documented type. Could also print out the runtimeType.

@blois
Copy link
Contributor

blois commented Dec 6, 2012

Added this to the M3 milestone.

@blois
Copy link
Contributor

blois commented Feb 8, 2013

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

@blois
Copy link
Contributor

blois commented Aug 26, 2013

In Chrome, JS, you can print(document.body) and it will give fancy element selection in the console.

I'd much rather have that than using the toString and just getting a string.


Removed Area-HTML label.
Added Area-Dartium label.

@jacob314
Copy link
Member

The fancy element selection in the console now works with the latest Dartium. I strongly encourage you to use it whenever you need to debug elements.

@jacob314
Copy link
Member

Note: to log an element to the console you need to use
window.console.log(document.body)
instead of
print(document.body)

@blois
Copy link
Contributor

blois commented Sep 12, 2013

Awesome!

Is this something that print() should support as well? It seems that the API converts to a string very early preventing fancier rendering of known types, but the API appears to support it.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the Later milestone.
Added Oldschool-Milestone-Later label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-Later label.

@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed triaged labels Feb 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

7 participants