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

Element.html gives an error #602

Closed
DartBot opened this issue Nov 26, 2011 · 4 comments
Closed

Element.html gives an error #602

DartBot opened this issue Nov 26, 2011 · 4 comments

Comments

@DartBot
Copy link

DartBot commented Nov 26, 2011

This issue was originally filed by jeffbailey@google.com


What steps will reproduce the problem?

import('dart:html');

main() {
  String a = "foo";
  DivElement myDiv = new Element.html("<div>" + a + "</div>");
}

What is the expected output? What do you see instead?

I expect a div with the appropriate text node attached. Instead I get:

/home/jeffbailey/Programming/gclienttree/dart/dart/client/html/release/html.dart:23638:10: warning: can not resolve "innerHTML" on "Element"
    temp.innerHTML = html;
         ^^^^^^^^^
/home/jeffbailey/Programming/gclienttree/dart/dart/client/html/release/html.dart:23646:40: warning: can not resolve "children" on "Element"
      return LevelDom.wrapElement(temp.children.item(tag == 'head' ? 0 : 1));
                                       ^^^^^^^^

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
ReferenceError: window is not defined
    at get$document (evalmachine.<anonymous>:616:10)
    at Function.ElementWrappingImplementation$html$factory (evalmachine.<anonymous>:1822:14)
    at main (evalmachine.<anonymous>:1928:45)
    at evalmachine.<anonymous>:1954:1
    at main (/home/jeffbailey/Programming/gclienttree/dart/dart/frog/frogsh:23725:10)
    at Object.<anonymous> (/home/jeffbailey/Programming/gclienttree/dart/dart/frog/frogsh:24089:1)
    at Module._compile (module.js:432:26)
    at Object..js (module.js:450:10)
    at Module.load (module.js:351:31)
    at Function._load (module.js:310:12)

What version of the product are you using? On what operating system?

Path: .
URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/client/html
Repository Root: http://dart.googlecode.com/svn
Repository UUID: 260f80e4-7a28-3924-810f-c04153c831b5
Revision: 1856
Node Kind: directory
Schedule: normal
Last Changed Author: jacobr@google.com
Last Changed Rev: 1771
Last Changed Date: 2011-11-22 17:12:10 -0800 (Tue, 22 Nov 2011)

Running on a Goobuntu Laptop.

Please provide any additional information below.

This is a reduced test case. It shows more errors than I get in my actual program. The first two are the same, though.

@DartBot
Copy link
Author

DartBot commented Nov 28, 2011

This comment was originally written by drfibonacci@google.com


Added Area-Frog, Triaged labels.

@jmesserly
Copy link

Can you try passing the "--compile-only --out=myapp.js" flag?

By default "frogsh" will try to run the code on the command line (similar to "python" "irb" "node" etc). And so it's not surprising that it doesn't find "window", since it's not running in a browser :)

Once you compile to "myapp.js", add that file to an HTML page and you should be good to go.

frog.py has a "--html" option that might do what you want--it generates an HTML page that references the script, and then opens a browser), but I haven't tried it in a while. And we haven't rolled that option into frogsh yet.

There's also the "htmlconverter.py" script for packaging up your HTML and generated JS code. We used that a lot for our Swarm sample. I don't recall offhand the exact command line arguments, but if you take a look at that script you can probably get it working.


Added Invalid label.

@DartBot
Copy link
Author

DartBot commented Nov 30, 2011

This comment was originally written by jeffbailey@google.com


I did use those options:

jeffbailey@cirrostratus:~/Programming/gittree/nethack-nacl/sys/nacl$ cat test.dart
#import('dart:html');

main() {
  String a = "foo";
  DivElement myDiv = new Element.html("<div>" + a + "</div>");
}
jeffbailey@cirrostratus:/Programming/gittree/nethack-nacl/sys/nacl$ rtest.^C
jeffbailey@cirrostratus:
/Programming/gittree/nethack-nacl/sys/nacl$ frogsh --compile-only --out=myapp.js test.dart
/home/jeffbailey/Programming/gclienttree/dart/dart/client/html/release/html.dart:23638:10: warning: can not resolve "innerHTML" on "Element"
    temp.innerHTML = html;
         ^^^^^^^^^
/home/jeffbailey/Programming/gclienttree/dart/dart/client/html/release/html.dart:23646:40: warning: can not resolve "children" on "Element"
      return LevelDom.wrapElement(temp.children.item(tag == 'head' ? 0 : 1));
                                       ^^^^^^^^
jeffbailey@cirrostratus:~/Programming/gittree/nethack-nacl/sys/nacl$

This is also a reduced test case from an app that I'm otherwise writing that is also using those options.


Added Triaged label.

@DartBot
Copy link
Author

DartBot commented Dec 8, 2011

This comment was originally written by jeffbailey@google.com


Appears to be fixed as of 2284.


Added Fixed label.

nex3 pushed a commit that referenced this issue Aug 31, 2016
dart-bot pushed a commit that referenced this issue Nov 6, 2020
2020-11-05 irina.arkhipets@gmail.com Fixes #602: New tests for least and greatest closures added.
2020-11-05 sgrekhov@unipro.ru #926. Rewrite io/Process/start_A01_t02 test to work on precompiled environment
2020-11-05 sgrekhov@unipro.ru #932. Rewrite HttpRequestUpload/onLoad_A01_t01 test to send correct HttpRequest
2020-11-04 sgrekhov@unipro.ru Fixes #956. Don't expect extension invocation on type dynamic
2020-11-04 karlklose@users.noreply.github.com Convert some multi-tests to static error framework  (#958)
2020-11-03 irina.arkhipets@gmail.com Fixes #602: dynamic tests for least and greatest closures updated.
2020-11-03 irina.arkhipets@gmail.com Fixes #602: tests for least and greatest closures added.
2020-10-28 sgrekhov@unipro.ru #926. Fix two Process tests to use 'process_test' tool
2020-10-28 sgrekhov@unipro.ru #926. Rewrite two Process tests to use 'process_test' tool
2020-10-28 sgrekhov@unipro.ru Fixes #955. Expect less specific error for typed_data tests
2020-10-26 sgrekhov@unipro.ru Fixes #954. Change the line where we expect an error for CFE
2020-10-20 sgrekhov@unipro.ru Fixes #912. Abstract variables syntax tests added
2020-10-19 sgrekhov@unipro.ru #912. More external variables syntax tests added
2020-10-17 sgrekhov@unipro.ru External variables syntax test added
2020-10-16 sgrekhov@unipro.ru #912. More test for static analysis of external variables added
2020-10-15 sgrekhov@unipro.ru #912. Test for static analysis of external variables added
2020-10-14 sgrekhov@unipro.ru #912. Test for static analysis if abstract variables added

Cq-Include-Trybots: dart/try:analyzer-nnbd-linux-release-try,analyzer-nnbd-win-release-try,dart2js-nnbd-linux-x64-chrome-try,ddc-nnbd-linux-release-chrome-try,front-end-nnbd-linux-release-x64-try,front-end-nnbd-win-release-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-win-release-x64-try
Change-Id: Id9cde784918faa4e891da8c4cb448d415a7a18aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170680
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
dart-bot pushed a commit that referenced this issue Nov 19, 2020
2020-11-19 sgrekhov@unipro.ru #926.Add Platform.executableArguments to Process.run() command to not to fail on --enable-assert configuration
2020-11-19 sgrekhov@unipro.ru #926.Add Platform.executableArguments to Process.run() command to not to fail on --enable-assert configuration
2020-11-18 sgrekhov@unipro.ru Fixes #966. Move certificates to RawSecureServerSocket directory
2020-11-18 sgrekhov@unipro.ru #926. Fixed test that fail on precompiled environment in a strong mode
2020-11-17 sgrekhov@unipro.ru Fixes #951. Remove excessive @static-warning
2020-11-17 irina.arkhipets@gmail.com Fixes #946: LanguageFeatures/Instantiate-to-bound/nonfunction_typedef tests updated according to the SDK changes, missing tests added.
2020-11-17 sgrekhov@unipro.ru #932. Some HttpRequest tests fixed to work well with cross origin requests
2020-11-16 sgrekhov@unipro.ru Process kill test fixed to work on different platforms
2020-11-16 sgrekhov@unipro.ru External variable test that expects compile time error on dart2js added
2020-11-13 sgrekhov@unipro.ru Fixes #926. Remove "--enable-experiment=non-nullable" option from script that runs another process
2020-11-12 sgrekhov@unipro.ru #926. File lock checking tests rewritten to not to fail on precompiled environment. Second part
2020-11-12 irina.arkhipets@gmail.com Fixes #602: Missing issue tags added.
2020-11-11 sgrekhov@unipro.ru #926. File lock checking tests rewritten to not to fail on precompiled environment
2020-11-11 sgrekhov@unipro.ru Issue numbers added
2020-11-11 irina.arkhipets@gmail.com Fixes #963: test expected result corrected, test template for all generic typedefs updated.
2020-11-10 sgrekhov@unipro.ru #926. ProcessSignal tests rewritten to not to fail on precompiled environment
2020-11-10 sgrekhov@unipro.ru #926. Process tests rewritten to not to fail on precompiled environment
2020-11-10 sgrekhov@unipro.ru #961. Process tests rewritten to not to use process_test tool
2020-11-10 irina.arkhipets@gmail.com Fixes #602: Missing Issue tag added.
2020-11-10 sgrekhov@unipro.ru Fixes #960. Null safety execution modes renamed and mentions of obsolete checked mode removed
2020-11-10 sgrekhov@unipro.ru Remove wrong error expectations
2020-11-09 sgrekhov@unipro.ru Fixes #962. Change CFE error messages expectations
2020-11-08 irina.arkhipets@gmail.com Fixes #602: New tests for least and greatest closures added.

Cq-Include-Trybots: dart/try:analyzer-nnbd-linux-release-try,dart2js-nnbd-linux-x64-chrome-try,ddc-nnbd-linux-release-chrome-try,front-end-nnbd-win-release-x64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-nnbd-win-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-win-release-x64-try
Change-Id: I7aff067ec96f762490de15daa20c40dff2b0ae96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172940
Reviewed-by: William Hesse <whesse@google.com>
copybara-service bot pushed a commit that referenced this issue Jan 24, 2023
args (https://github.com/dart-lang/args/compare/ac0e2c8..04c9346):
  04c9346  2023-01-19  Devon Carew  blast_repo fixes (#230)

async (https://github.com/dart-lang/async/compare/de1ce93..c9cc576):
  c9cc576  2023-01-23  Devon Carew  update changelog and pubspec version (#228)

intl (https://github.com/dart-lang/intl/compare/6140b60..3fcc810):
  3fcc810  2023-01-23  Copybara-Service  Merge pull request #535 from dart-lang:changeNumberOfDigitsCalculation
  07a73ca  2023-01-23  Moritz  Add license
  f0d0530  2023-01-20  Moritz  Add test
  aea7a7a  2023-01-20  Moritz  Fix bug in numberOfIntegerDigits calculation, simplifying the algorithm
  039f2b4  2023-01-20  Copybara-Service  Merge pull request #532 from dart-lang:removeTimezone
  c97ee27  2023-01-13  Moritz  Remove unimplemented timezone functionality

mockito (https://github.com/dart-lang/mockito/compare/9cc958a..7696557):
  7696557  2023-01-22  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.3.0 (#599)
  ee68765  2023-01-20  Devon Carew  generate code before we analyze (#601)
  09aabe7  2023-01-20  Sam Rawlins  GitHub Sync (#602)
  0128352  2023-01-19  Devon Carew  blast_repo fixes

test (https://github.com/dart-lang/test/compare/19582a8..53df527):
  53df5270  2023-01-23  Nate Bosch  Fix description of conditions without expectations (#1864)
  cbac7089  2023-01-23  Nate Bosch  Allow omitting the actual argument for rejections (#1861)
  af768a8f  2023-01-20  Nate Bosch  Add anyOf condition (#1859)
  387436bd  2023-01-20  Nate Bosch  Add unordered iterable comparisons (#1858)
  b3c78a4b  2023-01-19  Nate Bosch  Implement deep collection equality (#1853)
  e5a9f7d4  2023-01-19  Nate Bosch  Rename allowLateFailure -> allowUnawaited (#1854)

Change-Id: I9f82587285250f608e070d1380b836ee8238c5fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279642
Auto-Submit: Devon Carew <devoncarew@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@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
None yet
Projects
None yet
Development

No branches or pull requests

2 participants