Skip to content

Commit

Permalink
U: up placeholders 3.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
lizzie committed Nov 14, 2013
1 parent b3786f3 commit 63add1e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
4 changes: 2 additions & 2 deletions placeholders/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = function(grunt) {
return code
}
},
url: 'https://raw.github.com/jamesallardice/Placeholders.js/v<%= pkg.version %>/lib/main.js',
url: 'https://raw.github.com/jamesallardice/Placeholders.js/<%= pkg.version %>/lib/main.js',
name: 'placeholders.js'
},
utils: {
Expand All @@ -30,7 +30,7 @@ module.exports = function(grunt) {
return code
}
},
url: 'https://raw.github.com/jamesallardice/Placeholders.js/v<%= pkg.version %>/lib/utils.js',
url: 'https://raw.github.com/jamesallardice/Placeholders.js/<%= pkg.version %>/lib/utils.js',
name: 'utils.js'
}
}
Expand Down
20 changes: 16 additions & 4 deletions placeholders/dist/placeholders-debug.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define("gallery/placeholders/3.0.0/placeholders-debug", [ "./utils-debug" ], function(require, exports, module) {
define("gallery/placeholders/3.0.1/placeholders-debug", [ "./utils-debug" ], function(require, exports, module) {
require("./utils-debug");
(function(global) {
"use strict";
Expand All @@ -23,6 +23,15 @@ define("gallery/placeholders/3.0.0/placeholders-debug", [ "./utils-debug" ], fun
test = document.createElement("input"), head = document.getElementsByTagName("head")[0], root = document.documentElement, Placeholders = global.Placeholders, Utils = Placeholders.Utils, hideOnInput, liveUpdates, keydownVal, styleElem, styleRules, placeholder, timer, form, elem, len, i;
// No-op (used in place of public methods when native support is detected)
function noop() {}
// Avoid IE9 activeElement of death when an iframe is used.
// More info:
// http://bugs.jquery.com/ticket/13393
// https://github.com/jquery/jquery/commit/85fc5878b3c6af73f42d61eedf73013e7faae408
function safeActiveElement() {
try {
return document.activeElement;
} catch (err) {}
}
// Hide the placeholder value on a single element. Returns true if the placeholder was hidden and false if it was not (because it wasn't visible in the first place)
function hidePlaceholder(elem, keydownValue) {
var type, maxLength, valueChanged = !!keydownValue && elem.value !== keydownValue, isPlaceholderValue = elem.value === elem.getAttribute(ATTR_CURRENT_VAL);
Expand Down Expand Up @@ -141,7 +150,7 @@ define("gallery/placeholders/3.0.0/placeholders-debug", [ "./utils-debug" ], fun
}
function makeClickHandler(elem) {
return function() {
if (elem === document.activeElement && elem.value === elem.getAttribute(ATTR_CURRENT_VAL) && elem.getAttribute(ATTR_ACTIVE) === "true") {
if (elem === safeActiveElement() && elem.value === elem.getAttribute(ATTR_CURRENT_VAL) && elem.getAttribute(ATTR_ACTIVE) === "true") {
Utils.moveCaret(elem, 0);
}
};
Expand Down Expand Up @@ -177,7 +186,7 @@ define("gallery/placeholders/3.0.0/placeholders-debug", [ "./utils-debug" ], fun
elem.setAttribute(ATTR_EVENTS_BOUND, "true");
elem.setAttribute(ATTR_CURRENT_VAL, placeholder);
// If the element doesn't have a value and is not focussed, set it to the placeholder string
if (hideOnInput || elem !== document.activeElement) {
if (hideOnInput || elem !== safeActiveElement()) {
showPlaceholder(elem);
}
}
Expand Down Expand Up @@ -254,6 +263,9 @@ define("gallery/placeholders/3.0.0/placeholders-debug", [ "./utils-debug" ], fun
}
}, 100);
}
Utils.addEventListener(global, "beforeunload", function() {
disablePlaceholders();
});
// Expose public methods
Placeholders.disable = Placeholders.nativeSupport ? noop : disablePlaceholders;
Placeholders.enable = Placeholders.nativeSupport ? noop : enablePlaceholders;
Expand All @@ -266,7 +278,7 @@ define("gallery/placeholders/3.0.0/placeholders-debug", [ "./utils-debug" ], fun
}
});

define("gallery/placeholders/3.0.0/utils-debug", [], function(require, exports, module) {
define("gallery/placeholders/3.0.1/utils-debug", [], function(require, exports, module) {
/*
* The MIT License
*
Expand Down
2 changes: 1 addition & 1 deletion placeholders/dist/placeholders.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion placeholders/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"family": "gallery",
"name": "placeholders",
"version": "3.0.0",
"version": "3.0.1",
"author": "James Allardice <[email protected]>",
"description": "A JavaScript polyfill for the HTML5 placeholder attribute",
"homepage": "http://jamesallardice.github.io/Placeholders.js/",
Expand Down

0 comments on commit 63add1e

Please sign in to comment.