Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tinyDOM-Sideburns
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Louis
tinyDOM-Sideburns
Commits
ea12cbc2
Commit
ea12cbc2
authored
9 years ago
by
Louis Capitanchik
Browse files
Options
Downloads
Patches
Plain Diff
Create README.md
parent
39bc0949
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+28
-0
28 additions, 0 deletions
README.md
with
28 additions
and
0 deletions
README.md
0 → 100644
+
28
−
0
View file @
ea12cbc2
# tinyDOM-Sideburns
A tinyDOM plugin that integrates Sideburns into batch selector.
tinyDOM-Sideburns adds two new items to the mu global and one new function to the batch selector.
## Additions to mu
mu has been given the property "templates", which holds pre-compiled templates (A version of the
sideburns render function, pre-seeded with a node list containing the template) that were defined
on page load. Any of these templates can be invoked as a function, with only the
`data`
and
`options`
parameters required. See
[
the sideburns repo
](
https://github.com/BuyPro/Sideburns
)
for more information
about those parameters.
tinyDOM-Sideburns also adds the
`mu.render(template, data[, options])`
function. The
`template`
parameter
should be one of two things - either the name of a pre-compiled template (defined by the
`data-name`
attribute
on the template script tag) or a string containing a template. The string will first be compared to the keys
in the
`mu.templates`
object. If a match is found, that template will be used with the provided data and
options - otherwise, the
`template`
parameter will be interpreted as a template itself. In both cases, this
function works in the same way as the
`sideburns.render(template, data[, options])`
function in the aforementioned
sideburns repo, and will return a string.
## Additions to mu/batch
tinyDOM-Sideburns adds a
`render(template, data[, options])`
function to the mu batch object (obtained by using
`mu("ident")`
). It is identical to the
`mu.render(template, data[, options])`
function, but will automatically
set the inner content of each matched element to the rendered template instead of returning a string.
By default the batch method will set the
`innerHTML`
of the elements, but setting the
`useHtml`
property of
`options`
to
`false`
will cause the function to set the
`textContent`
instead (mitigating a potential xss vector
if you don't trust the content being rendered). textContent is supported in IE >= 9.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment