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

Master #17

Closed
wants to merge 6 commits into from
Closed
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
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "object.observe",
"version": "0.2.4",
"version": "0.2.6",
"homepage": "https://github.com/MaxArt2501/object-observe",
"authors": [
"Massimo Artizzu <maxart.x@gmail.com>"
Expand Down
10 changes: 10 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## v0.2.6

* Apply fix from MaxArt2501 at https://github.com/MaxArt2501/object-observe/pull/17 for #16

## v0.2.5

2015-10-13

* Fixes issue #16

## v0.2.4

2015-03-31
Expand Down
2 changes: 1 addition & 1 deletion dist/object-observe-lite.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Object.observe "lite" polyfill - v0.2.4
* Object.observe "lite" polyfill - v0.2.6
* by Massimo Artizzu (MaxArt2501)
*
* https://github.com/MaxArt2501/object-observe
Expand Down
10 changes: 5 additions & 5 deletions dist/object-observe.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Object.observe polyfill - v0.2.4
* Object.observe polyfill - v0.2.6
* by Massimo Artizzu (MaxArt2501)
*
* https://github.com/MaxArt2501/object-observe
Expand Down Expand Up @@ -246,13 +246,13 @@ Object.observe || (function(O, A, root, _undefined) {
* @param {Handler} handler
* @param {String[]} [acceptList]
*/
doObserve = function(object, handler, acceptList) {

doObserve = function (object, handler, acceptList) {
var data = observed.get(object);

if (data)
if (data) {
performPropertyChecks(data, object); // <- fixes #16
setHandler(object, data, handler, acceptList);
else {
} else {
data = createObjectData(object);
setHandler(object, data, handler, acceptList);

Expand Down
2 changes: 1 addition & 1 deletion dist/object-observe.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/object-observe.min.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "object.observe",
"version": "0.2.4",
"version": "0.2.6",
"description": "Object.observe polyfill based on ES7 spec",
"main": "dist/object-observe.js",
"directories": {
Expand Down
19 changes: 19 additions & 0 deletions test/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,25 @@ describe("Object.observe", function() {
} catch (e) { done(e); }
}, timeout);
});

it("should not notify about the changes made before observe called (should be run in IE or Firefox)", function (done) {
var obj = {};
var callback1 = function () {
};
var callback2 = function () {
done(new Error("this callback should not be called as it was attached after the changes were made "));
};

obj.value1 = "value 1";
Object.observe(obj, callback1);

obj.value2 = "value 2";
Object.observe(obj, callback2);

setTimeout(function () {
done();
}, 10);
});
});

describe("Object.unobserve", function() {
Expand Down