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

can-view-model

Package Overview
Dependencies
Maintainers
5
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-view-model - npm Package Compare versions

Comparing version 3.1.3 to 3.2.0-pre.0

20

can-view-model.md

@@ -9,3 +9,3 @@ @module {function} can-view-model can-view-model

Gets the map instance associated with **element**, creating one as a [can-util/js/types/types.DefaultMap] if it doesn't already exist, and returns the map.
Gets the map instance associated with **element**, creating one as a [can-types.DefaultMap] if it doesn’t already exist, and returns the map.

@@ -17,7 +17,7 @@ ```js

@return {can-map|can-define/map/map|Object} The ViewModel associated with this elelement.
@return {can-map|can-define/map/map|Object} The ViewModel associated with this element.
@signature `canViewModel(element, property)`
Gets the map instance associated with **element**, creating one as a [can-util/js/types/types.DefaultMap] if it doesn't already exist. Then gets the **property** inside of the ViewModel and returns that.
Gets the map instance associated with **element**, creating one as a [can-types.DefaultMap] if it doesn’t already exist. Then, gets the **property** inside of the ViewModel and returns that.

@@ -33,7 +33,7 @@ ```

@return {*} The value of the property on the ViewModel or undefined if the property doesn't exist.
@return {*} The value of the property on the ViewModel or undefined if the property doesn’t exist.
@signature `canViewModel(element, property, value)`
Gets the map instance associated with **element**, creating one as a [can-util/js/types/types.DefaultMap] if it doesn't already exist. Sets the **property** on that map to **value**.
Gets the map instance associated with **element**, creating one as a [can-types.DefaultMap] if it doesn’t already exist. Sets the **property** on that map to **value**.

@@ -48,3 +48,3 @@ ```js

@param {HTMLElement} element ANy element in the DOM.
@param {HTMLElement} element Any element in the DOM.
@param {String} property The property that is being set on the ViewModel.

@@ -59,3 +59,3 @@ @param {*} value The value being set on the property.

**can-view-model** is used to get and set properties on an element's ViewModel. Each element in the DOM can have an associated ViewModel. An example of this is a [can-component] and it's associated [can-component.prototype.ViewModel].
**can-view-model** is used to get and set properties on an element’s ViewModel. Each element in the DOM can have an associated ViewModel. An example of this is a [can-component] and its associated [can-component.prototype.ViewModel].

@@ -77,3 +77,3 @@ This shows a Component and getting its ViewModel:

The other signatures provide the ability to get and set properties on the ViewModel. For example, this sets the "foo" property on a component's viewModel:
The other signatures provide the ability to get and set properties on the ViewModel. For example, this sets the `foo` property on a component’s viewModel:

@@ -91,5 +91,5 @@ ```js

## Setting an element's ViewModel
## Setting an element’s ViewModel
One thing that can-view-model does ***not*** do is provide a way to set what an element's ViewModel should be. To do that, use [can-util/dom/data/data] instead like so:
One thing that can-view-model does ***not*** do is provide a way to set what an element’s ViewModel should be. To do that, use [can-util/dom/data/data] instead like so:

@@ -96,0 +96,0 @@ ```js

{
"name": "can-view-model",
"version": "3.1.3",
"version": "3.2.0-pre.0",
"description": "gets or sets the view model of an element",

@@ -33,3 +33,3 @@ "homepage": "http://canjs.com",

"can-namespace": "1.0.0",
"can-simple-map": "^3.0.0",
"can-simple-map": "^3.1.4-pre.1",
"can-types": "^1.0.1",

@@ -39,4 +39,4 @@ "can-util": "^3.1.1"

"devDependencies": {
"can-define": "^1.0.5",
"can-map": "^3.0.3",
"can-define": "^1.2.0-pre.1",
"can-map": "^3.1.0-pre.2",
"bit-docs": "0.0.7",

@@ -43,0 +43,0 @@ "done-serve": "^0.2.0",

@@ -16,3 +16,3 @@ # can-view-model

## <code>__can-view-model__ function</code>
Gets the ViewModel of an [element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement).
Gets the ViewModel of an [element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement).

@@ -23,3 +23,3 @@

Gets the map instance associated with **element**, creating one as a [can-util/js/types/types.DefaultMap] if it doesn't already exist, and returns the map.
Gets the map instance associated with **element**, creating one as a [can-types.DefaultMap] if it doesn’t already exist, and returns the map.

@@ -32,12 +32,12 @@ ```js

Any element in the DOM.
- __returns__ <code>{can-map|can-define/map/map|Object}</code>:
The ViewModel associated with this elelement.
The ViewModel associated with this element.
### <code>canViewModel(element, property)</code>
Gets the map instance associated with **element**, creating one as a [can-util/js/types/types.DefaultMap] if it doesn't already exist. Then gets the **property** inside of the ViewModel and returns that.
Gets the map instance associated with **element**, creating one as a [can-types.DefaultMap] if it doesn’t already exist. Then gets the **property** inside of the ViewModel and returns that.

@@ -55,12 +55,12 @@ ```

The property to get from the ViewModel.
- __returns__ <code>{*}</code>:
The value of the property on the ViewModel or undefined if the property doesn't exist.
The value of the property on the ViewModel or undefined if the property doesn’t exist.
### <code>canViewModel(element, property, value)</code>
Gets the map instance associated with **element**, creating one as a [can-util/js/types/types.DefaultMap] if it doesn't already exist. Sets the **property** on that map to **value**.
Gets the map instance associated with **element**, creating one as a [can-types.DefaultMap] if it doesn’t already exist. Sets the **property** on that map to **value**.

@@ -77,3 +77,3 @@ ```js

1. __element__ <code>{HTMLElement}</code>:
ANy element in the DOM.
Any element in the DOM.
1. __property__ <code>{String}</code>:

@@ -83,8 +83,8 @@ The property that is being set on the ViewModel.

The value being set on the property.
- __returns__ <code>{HTMLElement}</code>:
The element.
## Contributing

@@ -94,3 +94,3 @@

To make a build of the distributables into `dist/` in the cloned repository run
To make a build of the distributable files into `dist/` in the cloned repository run

@@ -104,3 +104,3 @@ ```

Tests can run in the browser by opening a webserver and visiting the `test.html` page.
Tests can run in the browser by opening a web server and visiting the `test.html` page.
Automated tests that run the tests from the command line in Firefox can be run with

@@ -107,0 +107,0 @@

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