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 2.0.0 to 2.0.1

15

behaviors-test.js

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

var queues = require("can-queues");
var dev = require("can-test-helpers").dev;

@@ -196,2 +197,16 @@ var mock = function(obj, fnName) {

});
dev.devOnlyTest("Warns when setting [type=date] value to a Date", function(assert) {
var input = document.createElement("input");
input.type = "date";
var ta = this.fixture;
ta.appendChild(input);
var obs = new AttributeObservable(input, "value");
var undo = dev.willWarn(/valueAsDate/);
obs.set(new Date());
assert.equal(undo(), 1, "Warned to use valueAsDate instead");
});
});

@@ -6,2 +6,3 @@ 'use strict';

var setData = require("can-dom-data");
var dev = require("can-log/dev/dev");
var domEvents = require("can-dom-events");

@@ -361,2 +362,3 @@ var domMutate = require("can-dom-mutate");

set: function(value){
var providedValue = value;
var nodeName = this.nodeName.toLowerCase();

@@ -395,2 +397,12 @@ if(nodeName === "input" || nodeName === "textarea") {

}
// Warnings area
//!steal-remove-start
if(process.env.NODE_ENV !== "production") {
var settingADateInputToADate = nodeName === "input" && this.type === "date" && (providedValue instanceof Date);
if(settingADateInputToADate) {
dev.warn("Binding a Date to the \"value\" property on an <input type=\"date\"> will not work as expected. Use valueAsDate:bind instead. See https://canjs.com/doc/guides/forms.html#Dateinput for more information.");
}
}
//!steal-remove-end
},

@@ -397,0 +409,0 @@ test: function(){

4

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

@@ -25,2 +25,3 @@ "main": "can-attribute-observable",

"devDependencies": {
"can-test-helpers": "^1.1.4",
"can-vdom": "^4.0.1",

@@ -41,2 +42,3 @@ "detect-cyclic-packages": "^1.1.1",

"can-globals": "^1.0.1",
"can-log": "^1.0.2",
"can-observation": "^4.0.1",

@@ -43,0 +45,0 @@ "can-observation-recorder": "^1.0.2",

@@ -51,3 +51,3 @@ var globals = require("can-globals");

var div = doc.createElement("div");
var undo = domMutate.onNodeInsertion(div, function () {
var undo = domMutate.onNodeConnected(div, function () {
undo();

@@ -54,0 +54,0 @@ doc.body.removeChild(div);

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