Skip to content

Extract reusable functions in inheritance #14

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

Merged
merged 13 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Extract CharacterData
  • Loading branch information
nojaf committed Nov 19, 2024
commit befe65960f1c782fe5ca167e717151836951bab5
4 changes: 2 additions & 2 deletions src/CSSFontLoadingAPI/FontFaceSet.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/CanvasAPI/OffscreenCanvas.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/ChannelMessagingAPI/MessagePort.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/ClipboardAPI/Clipboard.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/DOMAPI/Animation.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions src/DOMAPI/CharacterData.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

133 changes: 72 additions & 61 deletions src/DOMAPI/CharacterData.res
Original file line number Diff line number Diff line change
@@ -1,98 +1,109 @@
open DOMAPI
open EventAPI

include Node.Impl({
type t = characterData
})
module Impl = (
T: {
type t
},
) => {
include Node.Impl({
type t = T.t
})

external asCharacterData: T.t => characterData = "%identity"

/**
Inserts nodes just after node, while replacing strings in nodes with equivalent Text nodes.

Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/after)
*/
@send
external after: (T.t, node) => unit = "after"

/**
Inserts nodes just after node, while replacing strings in nodes with equivalent Text nodes.

/**
Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/after)
*/
@send
external after2: (T.t, string) => unit = "after"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/appendData)
*/
@send
external appendData: (T.t, string) => unit = "appendData"

/**
Inserts nodes just before node, while replacing strings in nodes with equivalent Text nodes.

Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/before)
*/
@send
external before: (characterData, node) => unit = "before"
@send
external before: (T.t, node) => unit = "before"

/**
/**
Inserts nodes just before node, while replacing strings in nodes with equivalent Text nodes.

Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/before)
*/
@send
external before2: (characterData, string) => unit = "before"
@send
external before2: (T.t, string) => unit = "before"

/**
Inserts nodes just after node, while replacing strings in nodes with equivalent Text nodes.
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/deleteData)
*/
@send
external deleteData: (T.t, ~offset: int, ~count: int) => unit = "deleteData"

Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/after)
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/insertData)
*/
@send
external after: (characterData, node) => unit = "after"
@send
external insertData: (T.t, ~offset: int, ~data: string) => unit = "insertData"

/**
Inserts nodes just after node, while replacing strings in nodes with equivalent Text nodes.
/**
Removes node.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/remove)
*/
@send
external remove: T.t => unit = "remove"

Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/after)
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/replaceData)
*/
@send
external after2: (characterData, string) => unit = "after"
@send
external replaceData: (T.t, ~offset: int, ~count: int, ~data: string) => unit = "replaceData"

/**
/**
Replaces node with nodes, while replacing strings in nodes with equivalent Text nodes.

Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/replaceWith)
*/
@send
external replaceWith: (characterData, node) => unit = "replaceWith"
@send
external replaceWith: (T.t, node) => unit = "replaceWith"

/**
/**
Replaces node with nodes, while replacing strings in nodes with equivalent Text nodes.

Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/replaceWith)
*/
@send
external replaceWith2: (characterData, string) => unit = "replaceWith"
@send
external replaceWith2: (T.t, string) => unit = "replaceWith"

/**
Removes node.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/remove)
*/
@send
external remove: characterData => unit = "remove"

/**
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/substringData)
*/
@send
external substringData: (characterData, ~offset: int, ~count: int) => string = "substringData"
@send
external substringData: (T.t, ~offset: int, ~count: int) => string = "substringData"
}

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/appendData)
*/
@send
external appendData: (characterData, string) => unit = "appendData"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/insertData)
*/
@send
external insertData: (characterData, ~offset: int, ~data: string) => unit = "insertData"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/deleteData)
*/
@send
external deleteData: (characterData, ~offset: int, ~count: int) => unit = "deleteData"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/replaceData)
*/
@send
external replaceData: (characterData, ~offset: int, ~count: int, ~data: string) => unit =
"replaceData"
include Impl({
type t = characterData
})
4 changes: 2 additions & 2 deletions src/DOMAPI/Document.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/DOMAPI/DocumentFragment.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/DOMAPI/Element.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/DOMAPI/FillStyle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/DOMAPI/HTMLButtonElement.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/DOMAPI/HTMLCanvasElement.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/DOMAPI/HTMLDialogElement.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/DOMAPI/HTMLElement.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/DOMAPI/HTMLEmbedElement.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/DOMAPI/HTMLFieldSetElement.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/DOMAPI/HTMLFormElement.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/DOMAPI/HTMLIFrameElement.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/DOMAPI/HTMLImageElement.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading