Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

can-attribute-observable

Package Overview
Dependencies
Maintainers
10
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-attribute-observable - npm Package Compare versions

Comparing version 1.2.6 to 1.2.7

.idea/can-attribute-observable.iml

27

behaviors-test.js

@@ -168,2 +168,29 @@ var testHelpers = require("../test/helpers");

});
testIfRealDocument("should use setAttributeNS instead of setAttribute for namespaced-attributes", function(assert) {
var svgNamespaceURI = "http://www.w3.org/2000/svg";
var xlinkHrefAttrNamespaceURI = "http://www.w3.org/1999/xlink";
var xlinkHrefAttr = "xlink:href";
var origValue = "icons.svg#logo";
var newValue = "icons.svg#pointDown";
var svg = document.createElementNS(svgNamespaceURI, "svg");
var svgUse = document.createElementNS(svgNamespaceURI, "use");
svgUse.setAttributeNS(xlinkHrefAttrNamespaceURI, xlinkHrefAttr, origValue);
svg.appendChild(svgUse);
var ta = this.fixture;
ta.appendChild(svg);
var obs = new AttributeObservable(svgUse, xlinkHrefAttr);
// test get
var origValueNS = obs.get(xlinkHrefAttr);
assert.equal(origValueNS, origValue, "get should match origValue");
// test set
obs.set(newValue);
assert.equal(svgUse.getAttributeNS(xlinkHrefAttrNamespaceURI, "href"), newValue, "getAttributeNS() should match newValue");
assert.equal(svgUse.getAttribute(xlinkHrefAttr), newValue, "getAttribute() should match newValue");
});
});

14

behaviors.js

@@ -13,2 +13,10 @@ 'use strict';

var xmlnsAttrNamespaceURI = "http://www.w3.org/2000/xmlns/";
var xlinkHrefAttrNamespaceURI = "http://www.w3.org/1999/xlink";
var attrsNamespacesURI = {
'xmlns': xmlnsAttrNamespaceURI,
'xlink:href': xlinkHrefAttrNamespaceURI
};
var formElements = {"INPUT": true, "TEXTAREA": true, "SELECT": true, "BUTTON": true},

@@ -500,3 +508,7 @@ // Used to convert values to strings.

set: function(val) {
domMutateNode.setAttribute.call(this, attrName, val);
if (attrsNamespacesURI[attrName]) {
domMutateNode.setAttributeNS.call(this, attrsNamespacesURI[attrName], attrName, val);
} else {
domMutateNode.setAttribute.call(this, attrName, val);
}
}

@@ -503,0 +515,0 @@ };

4

package.json
{
"name": "can-attribute-observable",
"version": "1.2.6",
"version": "1.2.7",
"description": "Create observables from HTML attributes.",

@@ -37,3 +37,3 @@ "main": "can-attribute-observable",

"can-dom-events": "^1.1.2",
"can-dom-mutate": "^1.0.3",
"can-dom-mutate": "^1.3.11",
"can-event-dom-radiochange": "^2.1.0",

@@ -40,0 +40,0 @@ "can-globals": "^1.0.1",

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