Skip to content

Commit

Permalink
Revert "implement script element"
Browse files Browse the repository at this point in the history
This reverts commit 00fba99.
  • Loading branch information
rmorshea committed Jan 27, 2022
1 parent 00fba99 commit 8c02d19
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
8 changes: 0 additions & 8 deletions src/client/packages/idom-client-react/src/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ export function Element({ model }) {
} else {
return null;
}
} else if (model.tagName == "script") {
return html`<${ScriptElement} script=${model.children[0]} />`;
} else if (model.importSource) {
return html`<${ImportedElement} model=${model} />`;
} else {
Expand All @@ -58,12 +56,6 @@ function StandardElement({ model }) {
);
}

function ScriptElement({ script }) {
const el = React.useRef();
React.useEffect(eval(script), [script]);
return null;
}

function ImportedElement({ model }) {
const layoutContext = React.useContext(LayoutContext);

Expand Down
18 changes: 1 addition & 17 deletions src/idom/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
- :func:`template`
"""

from .core.vdom import VdomDict, make_vdom_constructor
from .core.vdom import make_vdom_constructor


# Dcument metadata
Expand Down Expand Up @@ -253,22 +253,6 @@
del_ = make_vdom_constructor("del")
ins = make_vdom_constructor("ins")

# Scripting


def script(content: str) -> VdomDict:
"""Create a new `<{script}> <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script>`__ element.
Parameters:
content: The text of the script should evaluate to a function. This function
will be called when the script is initially created or when the content of the
script changes. The function may optionally return a teardown function that is
called when the script element is removed from the tree, or when the script
content changes.
"""
return {"tagName": "script", "children": [content]}


# Table content
caption = make_vdom_constructor("caption")
col = make_vdom_constructor("col")
Expand Down

0 comments on commit 8c02d19

Please sign in to comment.