New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

xsalt

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xsalt - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

2

bower.json
{
"name": "xsalt",
"main": "xsalt.js",
"version": "0.0.7",
"version": "0.0.8",
"homepage": "https://github.com/chocolatetoothpaste/xsalt",

@@ -6,0 +6,0 @@ "authors": [

{
"name": "xsalt",
"version": "0.0.7",
"version": "0.0.8",
"description": "A different kind of template engine",

@@ -5,0 +5,0 @@ "main": "xsalt.js",

@@ -21,2 +21,3 @@ # xsalt

One quick disclaimer: tags with restrictions on their child elements (select, table, etc...) are not handling xs:* prefixed children, they are stripping them out. Experiment a bit to make your template work (start with xs:option and append it to a select, rather than include the select in your template, for example)
Also, the examples previously have examples where a lot of closing tags were omitted. These examples would work, but it is probably best to include closing tags to ensure you get the structure you are expecting.

@@ -55,3 +56,3 @@ // Basic usage: prefix elements to process with "xs:"

var list = xsalt('<ul class="items users"><xs:li each="users" html="username" data-action="some action">');
var list = xsalt('<ul class="items users"><xs:li each="users" html="username" data-action="some action"></xs:li></ul>');

@@ -77,3 +78,3 @@ // passing in a callback, you can work with the DOM node. Wrap $(node) and

// each="." will use the root value of the data passed into compile
var options = xsalt('<xs:option each="." html="text" val="value">');
var options = xsalt('<select class="selectbox consoles"><xs:option each="." html="text" val="value"></xs:option></select>');

@@ -80,0 +81,0 @@ // output: <option value="1">PS4</option><option value="2">XBOX One</option><option value="3">Wii U</option>

(function(document) {
function xsalt(tmpl) {
// unfortunately HTML strips out certain tags if the parent tags has
// unfortunately HTML strips out certain tags if the parent tag has
// restrictions on child elements (like select boxes). This will prefeix ALL
// tags with "xs!:" that are not already prefixed with "xs:"
// totally sucks, but must be done until a better solution arises
tmpl = tmpl.replace(/<(?!\/?xs:)/g, '<xs!:');
tmpl = tmpl.replace(/<(\/?)(?!\/?xs:)/g, '<$1xs!:');
// console.log(tmpl);
// creating a sandbox for moving elements around

@@ -186,5 +188,7 @@ var temp = document.createElement('div');

var out = document.createElement('div');
// console.log(this.template.innerHTML)
// clean up all remaing "xs:" and variant prefixes
out.innerHTML = this.template.innerHTML.replace(/<(\/?)xs!?:/g, '<$1');
// console.log(out.innerHTML)

@@ -191,0 +195,0 @@ return out.innerHTML;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc