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

domjs

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

domjs - npm Package Compare versions

Comparing version 0.2.3 to 0.3.0

_construct-element.js

41

package.json
{
"name": "domjs",
"version": "0.2.3",
"description": "Build dom structure easy way with plain js. Client and server side template engine",
"version": "0.3.0",
"description": "DOM template engine for client and server",
"author": "Mariusz Nowak <medikoo@medikoo.com> (http://www.medikoo.com/)",
"keywords": [

@@ -12,4 +13,2 @@ "dom",

],
"author": "Mariusz Nowak <medikoo+domjs@medikoo.com> (http://www.medikoo.com/)",
"main": "lib/html5",
"repository": {

@@ -19,21 +18,25 @@ "type": "git",

},
"bugs": {
"email": "medikoo+domjs@medikoo.com",
"url": "https://github.com/medikoo/domjs/issues"
},
"scripts": {
"test": "node ./node_modules/tad/bin/tad lib"
},
"dependencies": {
"es5-ext": "0.8.x"
"d": "1",
"dom-ext": "0.0.3",
"es5-ext": "^0.10.12",
"es6-iterator": "2",
"es6-map": "^0.1.4",
"event-emitter": "^0.3.4",
"memoizee": "^0.4",
"observable-value": "0.0.5"
},
"devDependencies": {
"jsdom": "0.2.x",
"tad": "0.1.x"
"commander": "^2.9",
"jsdom": "^9.4.1",
"tad": "^0.2.4",
"xlint": "^0.2.2",
"xlint-jslint-medikoo": "^0.1.4"
},
"licence": "MIT",
"optionalDependencies": {},
"engines": {
"node": ">=0.4"
}
"scripts": {
"lint": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --no-cache --no-stream",
"lint-console": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --watch",
"test": "node ./node_modules/tad/bin/tad"
},
"license": "MIT"
}

@@ -1,2 +0,3 @@

# domjs - client and server side dom template engine
# domjs
## Client and server side dom template engine

@@ -6,14 +7,8 @@ Build dom structure easy way with plain JavaScript. Can be used on both client

## Instalation
### Installation
### Node.js
In your project path:
$ npm install domjs
### Browser
To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/)
You can easily create browser bundle with help of [modules-webmake](https://github.com/medikoo/modules-webmake). Mind that it relies on some EcmaScript5 features, so for older browsers you need as well [es5-shim](https://github.com/kriskowal/es5-shim)
## Usage

@@ -43,13 +38,57 @@

This is how templates for domjs are written.
This is how templates for domjs can be written.
To get `mytemplate` function content turned into DOM
(literally _DocumentFragment_):
Plain `domjs` usage example:
```javascript
var domjs = require('domjs/lib/html5')(document);
var domjs = require('domjs')(document);
var mydom = domjs.build(mytemplate);
var ns = domjs.ns;
var dom = domjs.collect(function () {
ns.header(
ns.h1('Heading'),
ns.h2('Subheading'));
ns.nav(
ns.ul({ 'class': 'breadcrumbs' },
ns.li(a({ href: '/' }, 'Home')),
ns.li(a({ href: '/section/'}, 'Section')),
ns.li(a('Subject'))));
ns.article(
ns.p('Lorem ipsum...'));
ns.footer('Footer stuff');
});
document.body.appendChild(dom); // Insert generated DOM into document body
```
To use domjs functions literally as in first example, you will need to prepare dedicated function wrapper
(either programmatically or manually) as e.g. following:
```javascript
var myTemplate = (function () {}
var article = ns.article, footer = ns.footer, h1 = ns.h1, h2 = ns.h2
, header = ns.header, li = ns.li, nav = ns.nav, p = ns.p, ul = ns.ul;
return function () {
header(
h1('Heading'),
h2('Subheading'));
nav(
ul({ 'class': 'breadcrumbs' },
li(a({ href: '/' }, 'Home')),
li(a({ href: '/section/'}, 'Section')),
li(a('Subject'))));
article(
p('Lorem ipsum...'));
footer('Footer stuff');
};
}());
var dom = domjs.collect(myTemplate);
```
### Other notes

@@ -105,4 +144,2 @@

As `jsdom` won't install properly on Windows domjs can only be tested only on _*nix_ systems
$ npm test

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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