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

typed-html

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typed-html - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

22

CHANGELOG.md

@@ -0,6 +1,26 @@

<a name="0.5.0"></a>
# 0.5.0 (2017-09-28)
* chore(build): Fix generate changelog script ([68ea3d9](https://github.com/nicojs/typed-html/commit/68ea3d9))
* docs(changelog): Add changelog ([eafa2eb](https://github.com/nicojs/typed-html/commit/eafa2eb))
* feat(boolean attributes): Add support for boolean attributes ([f6760e9](https://github.com/nicojs/typed-html/commit/f6760e9))
<a name="0.4.0"></a>
# 0.4.0 (2017-09-26)
* 0.4.0 ([935b486](https://github.com/nicojs/typed-html/commit/935b486))
* docs(package): Add repo, author and keywords fields ([cfd1d2c](https://github.com/nicojs/typed-html/commit/cfd1d2c))
* feat(integrity): Add `integrity` to `script` tag. ([3bfb42b](https://github.com/nicojs/typed-html/commit/3bfb42b))
<a name="0.3.3"></a>
## 0.3.3 (2017-07-14)
* 0.3.3 ([fd005b2](https://github.com/nicojs/typed-html/commit/fd005b2))
* docs: Add changelog ([8af1b68](https://github.com/nicojs/typed-html/commit/8af1b68))
* docs: Update changelog ([ff48418](https://github.com/nicojs/typed-html/commit/ff48418))
* test: Make tests timezone independent ([916adf4](https://github.com/nicojs/typed-html/commit/916adf4))
* docs: Add changelog ([8af1b68](https://github.com/nicojs/typed-html/commit/8af1b68))
* feat: add 'role' attribute to all html elements ([0bb4284](https://github.com/nicojs/typed-html/commit/0bb4284))

@@ -7,0 +27,0 @@

{
"name": "typed-html",
"version": "0.4.0",
"version": "0.5.0",
"description": "",

@@ -17,2 +17,4 @@ "main": "src/elements.js",

"preversion": "npm test",
"version": "npm run generate-changelog",
"generate-changelog": "conventional-changelog -r 0 > CHANGELOG.md && git add CHANGELOG.md",
"start": "tsc -w -p ."

@@ -36,5 +38,7 @@ },

"chai": "^3.5.0",
"conventional-changelog-cli": "^1.3.3",
"html-differ": "^1.3.4",
"mocha": "^3.2.0",
"rimraf": "^2.6.1",
"source-map-support": "^0.4.18",
"tslint": "^5.0.0",

@@ -41,0 +45,0 @@ "typescript": "^2.5.2"

@@ -143,3 +143,3 @@ [![Build Status](https://travis-ci.org/nicojs/typed-html.svg?branch=master)](https://travis-ci.org/nicojs/typed-html)

All HTML attributes support a string value, however some attributes also support a [`number`](https://developer.mozilla.org/en-US/docs/Glossary/Number) or [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/prototype) type:
All HTML attributes support a string value, however some attributes also support a [`number`](https://www.w3.org/TR/html51/infrastructure.html#numbers), [`Date`](https://www.w3.org/TR/html51/infrastructure.html#dates-and-times) or [`boolean`](https://www.w3.org/TR/html51/infrastructure.html#sec-boolean-attributes)(or absent value) type:

@@ -159,2 +159,7 @@ ```typescript

<del datetime={date}>old</del>;
// => <form> <input type="checkbox" checked> </form>
<form novalidate={false}>
<input type="checkbox" checked disabled={false}></input>
</form>
```

@@ -161,0 +166,0 @@

32

src/elements.js

@@ -38,13 +38,29 @@ "use strict";

};
var attributeValueToString = function (val) {
if (val instanceof Date) {
return val.toISOString();
var attributeToString = function (attributes) { return function (name) {
var value = attributes[name];
var formattedName = toKebabCase(name);
var makeAttribute = function (value) { return formattedName + "=\"" + value + "\""; };
if (value instanceof Date) {
return makeAttribute(value.toISOString());
}
else {
return escapeAttrNodeValue(val.toString());
}
};
else
switch (typeof value) {
case 'boolean':
// https://www.w3.org/TR/2008/WD-html5-20080610/semantics.html#boolean
if (value) {
return formattedName;
}
else {
return '';
}
default:
return makeAttribute(escapeAttrNodeValue(value.toString()));
}
}; };
var attributesToString = function (attributes) {
if (attributes) {
return ' ' + Object.keys(attributes).map(function (attribute) { return toKebabCase(attribute) + "=\"" + attributeValueToString(attributes[attribute]) + "\""; }).join(' ');
return ' ' + Object.keys(attributes)
.map(attributeToString(attributes))
.filter(function (attribute) { return attribute.length; }) // filter out negative boolean attributes
.join(' ');
}

@@ -51,0 +67,0 @@ else {

@@ -10,11 +10,12 @@ declare namespace JSX {

dir?: string;
hidden?: string;
hidden?: string | boolean;
id?: string;
role?: string;
lang?: string;
spellcheck?: string;
draggable?: string | boolean;
spellcheck?: string | boolean;
style?: string;
tabindex?: string;
title?: string;
translate?: string;
translate?: string | boolean;
}

@@ -74,3 +75,3 @@

name?: string;
novalidate?: string;
novalidate?: string | boolean;
target?: string;

@@ -104,3 +105,3 @@ type?: string;

src?: string; type?: string; width?: string; height?: string;
[anything: string]: string | undefined;
[anything: string]: string | boolean | undefined;
}

@@ -116,3 +117,3 @@

acceptCharset?: string;
action?: string; autocomplete?: string; enctype?: string; method?: string; name?: string; novalidate?: string; target?: string;
action?: string; autocomplete?: string; enctype?: string; method?: string; name?: string; novalidate?: string | boolean; target?: string;
}

@@ -138,4 +139,4 @@

autofocus?: string;
checked?: string;
disabled?: string;
checked?: string | boolean;
disabled?: string | boolean;
enctype?: string;

@@ -151,3 +152,3 @@ form?: string;

name?: string;
novalidate?: string;
novalidate?: string | boolean;
pattern?: string;

@@ -264,9 +265,9 @@ placeholder?: string;

interface HtmlScriptTag extends HtmlTag {
src?: string;
type?: string;
charset?: string;
src?: string;
type?: string;
charset?: string;
async?: string;
defer?: string;
crossorigin?: string;
integrity?: string;
defer?: string;
crossorigin?: string;
integrity?: string;
text?: string;

@@ -273,0 +274,0 @@ }

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