himalaya
Advanced tools
Comparing version 0.2.12 to 0.2.13
@@ -150,3 +150,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.himalaya = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
return str.trim().split(';').map(function (rule) { | ||
return rule.trim().split(':'); | ||
return splitHead(rule.trim(), ':'); | ||
}).reduce(function (styles, keyValue) { | ||
@@ -153,0 +153,0 @@ var _keyValue = _slicedToArray(keyValue, 2), |
@@ -96,3 +96,3 @@ 'use strict'; | ||
return str.trim().split(';').map(function (rule) { | ||
return rule.trim().split(':'); | ||
return splitHead(rule.trim(), ':'); | ||
}).reduce(function (styles, keyValue) { | ||
@@ -99,0 +99,0 @@ var _keyValue = _slicedToArray(keyValue, 2), |
{ | ||
"name": "himalaya", | ||
"description": "HTML to JSON parser", | ||
"version": "0.2.12", | ||
"version": "0.2.13", | ||
"author": "Chris Andrejewski <christopher.andrejewski@gmail.com>", | ||
@@ -6,0 +6,0 @@ "ava": { |
@@ -75,3 +75,3 @@ /* | ||
return str.trim().split(';') | ||
.map(rule => rule.trim().split(':')) | ||
.map(rule => splitHead(rule.trim(), ':')) | ||
.reduce((styles, keyValue) => { | ||
@@ -78,0 +78,0 @@ const [rawKey, rawValue] = keyValue |
@@ -33,1 +33,20 @@ import test from 'ava' | ||
}) | ||
test('formatStyles() should handle colons in CSS values', t => { | ||
const style = 'background-image: url(http://example.com/x.img)' | ||
t.deepEqual(formatStyles(style), { | ||
backgroundImage: 'url(http://example.com/x.img)' | ||
}) | ||
}) | ||
test('formatStyles() should preserve quoted values', t => { | ||
const doubleStyle = 'content: "hello"' | ||
t.deepEqual(formatStyles(doubleStyle), { | ||
content: '"hello"' | ||
}) | ||
const singleStyle = "content: 'hello'" | ||
t.deepEqual(formatStyles(singleStyle), { | ||
content: "'hello'" | ||
}) | ||
}) |
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
387715
3133