Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated event handlers #510

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ $("#hideButtons").spectrum({


var isDisabled = true;
$("#toggle-disabled").click(function() {
$("#toggle-disabled").on("click", function() {
if (isDisabled) {
$("#disabled").spectrum("enable");
}
Expand Down Expand Up @@ -464,12 +464,12 @@ $("#triggerSet").spectrum({
// Show the original input to demonstrate the value changing when calling `set`
$("#triggerSet").show();

$("#btnEnterAColor").click(function() {
$("#btnEnterAColor").on("click", function() {
$("#triggerSet").spectrum("set", $("#enterAColor").val());
});

$("#toggle").spectrum();
$("#btn-toggle").click(function() {
$("#btn-toggle").on("click", function() {
$("#toggle").spectrum("toggle");
return false;
});
Expand Down
4 changes: 2 additions & 2 deletions example/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ $(function() {
]
});

$("#size").change(function() {
$("#size").on("change", function() {
var size = Math.min(500, Math.max(50, $(this).val()));
$(".sp-picker-container").width(size);

colorpickerInput.spectrum("reflow");
});

$("#huesize").change(function() {
$("#huesize").on("change", function() {
var size = Math.min(80, Math.max(5, $(this).val()));

$(".sp-hue").css("left", (103 - size) + "%");
Expand Down
12 changes: 6 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -759,10 +759,10 @@ <h2 id="events">Events</h2>
});

// Alternatively, they can be added as an event listener:
$("#picker").on('move.spectrum', function(e, tinycolor) { });
$("#picker").on('show.spectrum', function(e, tinycolor) { });
$("#picker").on('hide.spectrum', function(e, tinycolor) { });
$("#picker").on('beforeShow.spectrum', function(e, tinycolor) { });
$("#picker").on("move.spectrum", function(e, tinycolor) { });
$("#picker").on("show.spectrum", function(e, tinycolor) { });
$("#picker").on("hide.spectrum", function(e, tinycolor) { });
$("#picker").on("beforeShow.spectrum", function(e, tinycolor) { });
</pre>

<h3 id="events-change">change</h3>
Expand Down Expand Up @@ -965,7 +965,7 @@ <h3 id="methods-toggle">toggle</h3>
</div>

<pre class='prettyprint'>
$("#btn-toggle").click(function() {
$("#btn-toggle").on("click", function() {
$("#toggle").spectrum("toggle");
return false;
});
Expand Down Expand Up @@ -1011,7 +1011,7 @@ <h3 id="methods-set">set</h3>
// Show the original input to demonstrate the value changing when calling `set`
$("#triggerSet").show();

$("#btnEnterAColor").click(function() {
$("#btnEnterAColor").on("click", function() {
$("#triggerSet").spectrum("set", $("#enterAColor").val());
});
&lt;/script&gt;
Expand Down
4 changes: 2 additions & 2 deletions spectrum.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,14 +321,14 @@
}

// Prevent clicks from bubbling up to document. This would cause it to be hidden.
container.click(stopPropagation);
container.on("click", stopPropagation);

// Handle user typed input
textInput.change(setFromTextInput);
textInput.on("paste", function () {
setTimeout(setFromTextInput, 1);
});
textInput.keydown(function (e) { if (e.keyCode == 13) { setFromTextInput(); } });
textInput.on("keydown", function (e) { if (e.keyCode == 13) { setFromTextInput(); } });

cancelButton.text(opts.cancelText);
cancelButton.on("click.spectrum", function (e) {
Expand Down