New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

hyperquery

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyperquery - npm Package Compare versions

Comparing version
1.0.0
to
1.0.1
+1
-1
package.json
{
"name": "hyperquery",
"version": "1.0.0",
"version": "1.0.1",
"description": "Query language for hyperscript",

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

@@ -11,15 +11,17 @@ VNode = require 'virtual-dom/vnode/vnode'

patch = ->
VText::properties = {}
# Always an element node
VNode::nodeType = 1
VNode::style = {}
VNode::parentNode = null
VNode::nextSibling = null
VNode::previousSibling = null
VNode::firstChild = null
VNode::lastChild = null
VText::nodeType = VNode::nodeType = 1
VText::style = VNode::style = {}
VText::parentNode = VNode::parentNode = null
VText::nextSibling = VNode::nextSibling = null
VText::previousSibling = VNode::previousSibling = null
VText::firstChild = VNode::firstChild = null
VText::lastChild = VNode::lastChild = null
VNode::createElement = (type) ->
VText::createElement = VNode::createElement = (type) ->
h type
VNode::getElementById = (id) ->
VText::getElementById = VNode::getElementById = (id) ->
result = null

@@ -34,3 +36,3 @@ walk @, (node) ->

VNode::getElementsByClassName = (className) ->
VText::getElementsByClassName = VNode::getElementsByClassName = (className) ->
result = []

@@ -44,3 +46,3 @@ walk @, (node) ->

VNode::getElementsByTagName = (tagName) ->
VText::getElementsByTagName = VNode::getElementsByTagName = (tagName) ->
result = []

@@ -55,3 +57,3 @@ tagName = tagName.toUpperCase()

VNode::querySelectorAll = (selector) ->
VText::querySelectorAll = VNode::querySelectorAll = (selector) ->
if qsaSupportedRe.test selector

@@ -67,12 +69,12 @@ switch selector[0]

VNode::setAttribute = (key, value) ->
VText::setAttribute = VNode::setAttribute = (key, value) ->
@properties[key] = value
VNode::getAttribute = (key) ->
VText::getAttribute = VNode::getAttribute = (key) ->
return @properties[key]
VNode::removeAttribute = (key) ->
VText::removeAttribute = VNode::removeAttribute = (key) ->
delete @properties[key]
VNode::cloneNode = (deep) ->
VText::cloneNode = VNode::cloneNode = (deep) ->
if deep

@@ -102,3 +104,3 @@ return udc @

VNode::insertBefore = (newElement, referenceElement)->
VText::insertBefore = VNode::insertBefore = (newElement, referenceElement)->
if !referenceElement?

@@ -118,3 +120,3 @@ @children.push newElement

VNode::appendChild = (node)->
VText::appendChild = VNode::appendChild = (node)->
@children.push node

@@ -126,3 +128,3 @@ setupShimValues node

VNode::removeChild = (node)->
VText::removeChild = VNode::removeChild = (node)->
i = 0

@@ -147,3 +149,3 @@ for child in @children

$.contains = (container, contains)->
if contains instanceof VNode
if contains instanceof VNode || element instanceof VText
return false

@@ -161,2 +163,34 @@ return originalContains.apply @, arguments

originalVal = $.fn.val
$.fn.val = (value)->
for node in @
if node.tagName == 'INPUT'
#softhook
node.value = ''+node.properties.value.value || ''
else if node.tagName == 'SELECT'
node.multiple = node.properties.multiple || undefined
for child in node.children
if child.tagName == 'OPTION'
child.selected = child.properties.selected || undefined
child.value = ''+child.properties.value || ''
node.value = child.value if child.selected
else
node.value = node.properties.value || ''
ret = originalVal.apply @, arguments
for node in @
if node.tagName == 'INPUT'
#softhook
node.properties.value.value = node.value
else if node.tagName == 'SELECT'
for child in node.children
if child.tagName == 'OPTION'
if ret.value instanceof Array
child.properties.selected = child.value in ret.value
else
child.properties.selected = child.value == ret.value
child.properties.value = child.value
else
node.properties.value = node.value
return ret
patchWindow = (win)->

@@ -175,2 +209,7 @@ if win? && win.getComputedStyle?

}
else if element instanceof VText
return {
getPropertyValue: (property)->
return undefined
}
else

@@ -177,0 +216,0 @@ return nativeGetComputedStyle(element, pseudo)

@@ -58,3 +58,3 @@ {expect} = require 'chai'

it 'should add style.cssText to vdom', ->
it 'should add style.cssText shim to vdom', ->
css = h 'div', style: 'background: red'

@@ -107,1 +107,20 @@ Zepto(css).css 'display', 'none'

expect($node3[0]).to.eq undefined
it 'should add value shim to vdom', ->
input = h 'input', value: '100'
$node = Zepto(input)
expect($node.val()).to.eq '100'
$node.val(200)
expect($node.val()).to.eq '200'
select = h 'select', [
h 'option', { value: '100', selected: false }
h 'option', { value: '200', selected: true }
h 'option', { value: '300', selected: false }
]
$node = Zepto(select)
expect($node.val()).to.eq '200'
$node.val('300')
expect($node.val()).to.eq '300'