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

angular-placeholder

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-placeholder - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

gruntfile.js

8

bower.json
{
"name": "angular-placeholder-tai",
"version": "1.0.2",
"version": "1.0.3",
"description": "Placeholder shim for IE8/IE9 and styling simplification.",

@@ -27,3 +27,7 @@ "author": "Tyler Akins <fidian@rumkin.com>",

],
"license": "MIT"
"license": "MIT",
"devDependencies": {
"angular": "1.2",
"angular-mocks": "1.2"
}
}

@@ -8,3 +8,2 @@ module.exports = function (grunt) {

tasks = [
"bowerful",
"default",

@@ -11,0 +10,0 @@ "karma:sauce"

@@ -38,3 +38,4 @@ /**

"$document",
function ($document) {
"$timeout",
function ($document, $timeout) {
// Determine if we need to perform the visual shimming

@@ -59,34 +60,41 @@ angular.forEach([ 'INPUT', 'TEXTAREA' ], function (val) {

link: function ($scope, $element, $attributes, $controller) {
var className, currentValue, text;
/*jslint unparam:true*/
var className, needsShim, text;
text = $attributes[propName];
className = $attributes[propName + "Class"] || propName;
needsShim = needsShimByNodeName[$element[0].nodeName];
// This does the class toggling depending on if there
// is a value or not.
$scope.$watch($attributes.ngModel, function (newVal) {
currentValue = newVal || "";
// On blur, check the value. If nothing is entered then
// add the placeholder class and text.
$element.bind("blur", function () {
var currentValue;
currentValue = $element.val();
if (!currentValue) {
$element.addClass(className);
} else {
$element.removeClass(className);
if (needsShim) {
/* Add a delay so the value isn't assigned to
* scope. Issue #9
*/
$timeout(function () {
$element.val(text);
}, 1);
}
}
});
if (needsShimByNodeName[$element[0].nodeName]) {
// These bound events handle user interaction
$element.bind("focus", function () {
if (currentValue === "") {
// Remove placeholder text
$element.val("");
}
});
$element.bind("blur", function () {
if ($element.val() === "") {
// Add placeholder text
$element.val(text);
}
});
// When focused, check if the field has the placeholder
// class. If so, wipe the field out.
$element.bind("focus", function () {
if (needsShim && $element.hasClass(className)) {
$element.val("");
}
$element.removeClass(className);
});
if (needsShim) {
// This determines if we show placeholder text or not

@@ -102,6 +110,25 @@ // when there was a change detected on scope.

// Show placeholder text instead of empty value
return val || text;
// When there is a value, this is not a placeholder.
if (val) {
$element.removeClass(className);
return val;
}
$element.addClass(className);
return text;
});
}
// Update the class on scope changes.
$scope.$watch(function () {
return $element.val();
}, function (newVal) {
if (newVal) {
$element.removeClass(className);
} else {
$element.addClass(className);
}
});
}

@@ -108,0 +135,0 @@ };

{
"name": "angular-placeholder",
"version": "1.0.2",
"version": "1.0.3",
"description": "Placeholder shim for IE8/IE9 and styling simplification.",

@@ -26,6 +26,7 @@ "author": "Tyler Akins <fidian@rumkin.com>",

},
"main": "./lib/tai-placeholder.js",
"dependencies": {},
"devDependencies": {
"bower": "*",
"grunt": "*",
"grunt-bowerful": "*",
"grunt-cli": "*",

@@ -36,2 +37,3 @@ "grunt-contrib-uglify": "*",

"grunt-newer": "*",
"jasmine-core": "*",
"karma": "*",

@@ -46,2 +48,3 @@ "karma-jasmine": "*",

"scripts": {
"bower": "bower install",
"test": "grunt test"

@@ -48,0 +51,0 @@ },

@@ -6,6 +6,6 @@ Angular Placeholder Directive

[![NPM][npm-image]][NPM]
[![Build Status][travis-image]][Travis CI]
[![Dependencies][dependencies-image]][Dependencies]
[![Dev Dependencies][devdependencies-image]][Dev Dependencies]
[![npm version][npm-badge]][npm-link]
[![Build Status][travis-badge]][travis-link]
[![Dependencies][dependencies-badge]][dependencies-link]
[![Dev Dependencies][devdependencies-badge]][devdependencies-link]

@@ -85,3 +85,3 @@

First, clone the repository. Then you need to run `npm install` to get most of the dependencies and `grunt bowerful` for the rest.
First, clone the repository. Then you need to run `npm install` to get most of the dependencies and `npm run bower` for the rest.

@@ -104,11 +104,15 @@

This plugin is licensed under an MIT license with an additional non-advertising clause. See [LICENSE.md](LICENSE.md).
This plugin is licensed under an MIT license with an additional non-advertising clause. [Read full license.][LICENSE]
[Dev Dependencies]: https://david-dm.org/tests-always-included/angular-placeholder#info=devDependencies
[devdependencies-image]: https://david-dm.org/tests-always-included/angular-placeholder/dev-status.png
[Dependencies]: https://david-dm.org/tests-always-included/angular-placeholder
[dependencies-image]: https://david-dm.org/tests-always-included/angular-placeholder.png
[NPM]: https://npmjs.org/package/angular-placeholder
[npm-image]: https://nodei.co/npm/angular-placeholder.png?downloads=true&stars=true
[travis-image]: https://secure.travis-ci.org/tests-always-included/angular-placeholder.png?branch=master
[Travis CI]: http://travis-ci.org/tests-always-included/angular-placeholder
[codecov-badge]: https://img.shields.io/codecov/c/github/tests-always-included/angular-placeholder/master.svg
[codecov-link]: https://codecov.io/github/tests-always-included/angular-placeholder?branch=master
[dependencies-badge]: https://img.shields.io/david/tests-always-included/angular-placeholder.svg
[dependencies-link]: https://david-dm.org/tests-always-included/angular-placeholder
[devdependencies-badge]: https://img.shields.io/david/dev/tests-always-included/angular-placeholder.svg
[devdependencies-link]: https://david-dm.org/tests-always-included/angular-placeholder#info=devDependencies
[LICENSE]: LICENSE.md
[npm-badge]: https://img.shields.io/npm/v/angular-placeholder.svg
[npm-link]: https://npmjs.org/package/angular-placeholder
[travis-badge]: https://img.shields.io/travis/tests-always-included/angular-placeholder/master.svg
[travis-link]: http://travis-ci.org/tests-always-included/angular-placeholder

@@ -10,7 +10,7 @@ module.exports = function (config) {

],
captureTimeout: 60000,
captureTimeout: 120000,
colors: true,
files: [
'components/angular/angular.js',
'components/angular-mocks/angular-mocks.js',
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'lib/*.js'

@@ -17,0 +17,0 @@ ],

Sorry, the diff of this file is not supported yet

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