1.0.0 • Published 8 months ago

@jtorm/insert-method v1.0.0

Weekly downloads
-
License
GPL-3.0
Repository
gitlab
Last release
8 months ago

jTorm Insert Method

Insert HTML in the Document Object Model (DOM) tree with help of the insertAdjacentHTML method. The following method aliases are available as well to set in the context methods:

  • jTormAppendMethod = append/beforeend
  • jTormPrependMethod = prepend/afterbegin
  • jTormBeforeMethod = before/beforebegin
  • jTormAfterMethod = after/afterend
  • jTormReplaceMethod = replace/innerHTML

Install

npm install @jtorm/insert-method

Properties

OptionRequiredTypeDescription
mtruestringMethod: a=append, p=prepend, b=before, af=after, r=replace.
hfalsehtmlHTML.
dfalsedataWhen there are child items, alternative data to process can be set here.
pfalsedataPrefix for 'h'.
sfalsedataSuffix for 'h'.
lfalsedataCache language scope.
cidfalsedataCache id.
csfalsedataCache scope.

Example

body->insert {
    m: 'a';
    h: '<section><b>append me</b></section>';
    div {
        ->prepend {
            h: '<header><h3>Header</h3></header>';
        }

        ->append {
            h: '<footer>footer</footer>';
        }
    }
}
1.0.0

8 months ago

0.0.4

2 years ago

0.0.3

3 years ago

0.0.2

3 years ago