Skip to content

Element.html gives an error #602

Closed
Closed
@DartBot

Description

@DartBot

This issue was originally filed by [email protected]


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: [email protected]
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions