-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/release/0.10.8'
- Loading branch information
Showing
10 changed files
with
94 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export type * from "../dist/jsx-runtime.d.ts" | ||
export type * from '../dist/jsx-runtime.d.ts' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ declare namespace JSX { | |
interface IntrinsicElements { | ||
[elemName: string]: any | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) 2020 Dirk Holtwick. All rights reserved. https://holtwick.de/copyright | ||
|
||
import { handleHTML } from "./manipulate" | ||
|
||
describe("manipulate", () => { | ||
|
||
it("should manipulate html", () => { | ||
const html = `<!DOCTYPE html> | ||
<html lang="de"> | ||
<body> | ||
<p class="img-wrapper"><img src="/assets/ocr@2x-97ede361.png" alt="" width="621" height="422"></p> | ||
</body> | ||
</html> | ||
` | ||
|
||
let rhtml = handleHTML(html, document => { | ||
let img = document.querySelector('.img-wrapper img') | ||
console.log('img', img) | ||
if (img) { | ||
img.setAttribute('title', 'hello') | ||
} | ||
}) | ||
|
||
expect(rhtml).toMatchInlineSnapshot( ` | ||
"<!DOCTYPE html> | ||
<html lang=\\"de\\"> | ||
<body> | ||
<p class=\\"img-wrapper\\"><img src=\\"/assets/ocr@2x-97ede361.png\\" alt=\\"\\" width=\\"621\\" height=\\"422\\"></p> | ||
</body> | ||
</html> | ||
" | ||
`) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import type { VDocumentFragment, VHTMLDocument } from './vdom' | ||
import { parseHTML } from './vdomparser' | ||
|
||
export function handleHTML(html: string, handler: (document: VHTMLDocument | VDocumentFragment) => void) { | ||
const document = parseHTML(html) | ||
handler(document) | ||
return document.render() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters