Commit Graph

47 Commits

Author SHA1 Message Date
Ian MacLeod
b0c86bd9f4 update package.json 2014-10-31 13:07:39 -07:00
Ian MacLeod
da46662007 Update the readme to include @addyosmani's notes 2014-10-31 12:54:43 -07:00
Ian MacLeod
38f31ce11c bower.json 2014-10-31 12:45:07 -07:00
Ian MacLeod
4f5cdd735d Dev mode loader for webcomponentsjs-lite.js 2014-10-31 12:44:13 -07:00
Ian MacLeod
42a99f03d5 master now contains dev sources; original history preserved. 2014-10-31 12:20:27 -07:00
Addy Osmani
08cb2e3d2e Merge pull request #19 from timoxley/patch-1
Fix accidental global variable
2014-10-30 09:36:21 +00:00
Tim Oxley
b891c849c0 Fix accidental global variable
One of the dangers of chaining with commas.
2014-10-30 05:50:39 +10:00
Erik Arvidsson
c5d3f29fd7 Merge pull request #9 from WebReflection/patch-1
Fix corrupted inheritance when deleting a key
2014-10-28 13:40:09 +01:00
Daniel Freedman
30eed93d4e update build 2014-10-24 13:27:12 -07:00
Ian MacLeod
49f383f11c Merge pull request #8 from Polymer/ie10-wb
Fix for IE10 flaking. Fixes #5
2014-10-24 11:48:54 -07:00
Ian MacLeod
78462d87b8 Fix a heinous IE10 (and below) bug where it may drop events on the
floor for MutationObserver & friends.
2014-10-24 11:47:36 -07:00
Addy Osmani
bdd4aba5d8 Merge pull request #1 from Polymer/readme
Summarize why we have this repo.
2014-10-24 09:34:44 +01:00
Ian MacLeod
ab602ea2d5 Some more notes on why we've got this repo 2014-10-23 15:53:34 -07:00
Andrea Giammarchi
c3f6ac623f Fix corrupted inheritance when deleting a key
Returning `hasValue` blindly without checking if `entry[0] === key` but after erasing those two references causes problems when inheritance is involved, either with `Object.create` or simply via `Constructor.prototype`.

This should not happen:

```js
var wm = new WeakMap;
var key = {};

wm.set(key, {});

// this should not affect `key` status
wm.delete(Object.create(key));

return wm.get(key); // shenanigans
```


Moreover, it would be probably not as fast but surely simpler to just rely on `this.has(key)` instead of repeating same check all over, example:

```js
if (typeof WeakMap === 'undefined') {
  (function() {
    var defineProperty = Object.defineProperty;
    var counter = Date.now() % 1e9;

    var WeakMap = function() {
      this.name = '__st' + (Math.random() * 1e9 >>> 0) + (counter++ + '__');
    };

    WeakMap.prototype = {
      set: function(key, value) {
        if (this.has(key)) {
          key[this.name][1] = value;
        } else {
          defineProperty(key, this.name, {value: [key, value], writable: true});
        }
        return this;
      },
      get: function(key) {
        return this.has(key) ? key[this.name][1] : void 0;
      },
      delete: function(key) {
        return this.has(key) && !(key[this.name].length = 0);
      },
      has: function(key) {
        var entry = key[this.name];
        if (!entry) return false;
        return entry[0] === key;
      }
    };

    window.WeakMap = WeakMap;
  })();
}
```

However, regardless specs talk about internal `key, value` slots this solution does not really have any concrete advantage on using an `Array` if not avoiding `delete` to make the object slower but that method is usually not frequently used with `WeakMap` ( reason these are demanded is that you can forget about `keys`, right ? ;-) )

Accordingly, I wonder why you didn't go for something more like [the following](https://gist.github.com/WebReflection/5991636) where also there is a standard `clear()` method which will leak like a charm in this polyfill too.

**leaking** on `.clear()` would be indeed a note you should put after you have implemented the method because all previously set `keys` cannot possibly be cleaned up but _at least you won't pollute the global scope with a broken polyfill that does not allow to invoke a legit `.clear()`_

The utterable in the constructor would be eventually another thing this polyfill needs, but I start wondering why is this even needed for `CustomElements` since [the version I've polyfilled](https://github.com/WebReflection/document-register-element) seems to work pretty well without bringing in `WeakMap` at all.

I'd love to understand why you need to ship this file, thanks for any sort of outcome.
2014-10-23 11:27:01 +01:00
Ian MacLeod
5762a166d0 example to test IE10 task flaking. 2014-10-22 17:31:46 -07:00
Steve Orvell
c97b56a2fa Change naming: compressed versions now with -min.js 2014-10-17 10:13:51 -07:00
Steve Orvell
caef618f37 include 'lite' build. 2014-10-17 10:12:31 -07:00
Steve Orvell
b6cf8b11e9 CustomElements: ensure polyfill api is available when native. 2014-10-16 15:37:48 -07:00
Steve Orvell
13e41d5ecb don't error if script name is changed. 2014-10-16 15:04:08 -07:00
Daniel Freedman
c20ae22bac use two spaces for debug files 2014-10-16 12:58:54 -07:00
Daniel Freedman
f1e5fb8416 Add version task
Order tasks for version, builds, and auditing with run-sequence
Drop unique-concat
2014-10-16 11:36:47 -07:00
Daniel Freedman
6e4d9721aa update build 2014-10-15 14:03:19 -07:00
Daniel Freedman
dc96d2296d Add auditing
Refactor gulpfile slightly to set up task depenedencies correctly
2014-10-15 11:43:30 -07:00
Steve Orvell
257a53b4fa update builds. 2014-10-14 14:17:46 -07:00
Steve Orvell
311dfb77f6 maintain Platform alias for bc. 2014-10-14 14:17:26 -07:00
Daniel Freedman
14192b434c add license header to builds 2014-10-14 11:31:55 -07:00
Steve Orvell
fec56f2f7f remove unneeded package.json 2014-10-14 10:37:18 -07:00
Steve Orvell
8dde68b95f update builds. 2014-10-14 10:27:49 -07:00
Steve Orvell
410a8c5d1e update build filenames: *.js for production use, *.debug.js for debugging. 2014-10-14 10:27:12 -07:00
Steve Orvell
4946d004b9 update read me. 2014-10-13 18:57:28 -07:00
Steve Orvell
d628b96d78 update read me. 2014-10-13 18:55:57 -07:00
Steve Orvell
9453a12c23 update builds. 2014-10-13 18:54:45 -07:00
Steve Orvell
38dc27dcc0 spacing. 2014-10-13 18:53:24 -07:00
Steve Orvell
c809116b62 execute all builds by default. 2014-10-13 18:49:40 -07:00
Steve Orvell
d242ca01d1 run maor tests. 2014-10-13 17:28:55 -07:00
Steve Orvell
16ab46f182 build cleanup 2014-10-13 17:28:41 -07:00
Steve Orvell
b8d6010d90 remove first script warning. 2014-10-13 17:28:16 -07:00
Steve Orvell
7870e9a631 add build support 2014-10-13 17:06:18 -07:00
Steve Orvell
25c7958dc6 remove Chrome apps sandbox support helper. It's unneeded now that HTMLImports are native in Chrome. 2014-10-13 14:27:33 -07:00
Steve Orvell
8e62cc9df6 make script finding more robust and make sure log flags are set 2014-10-13 14:22:01 -07:00
Steve Orvell
15eeb62cd2 Fixes https://github.com/Polymer/webcomponents.js-dev/issues/1 2014-10-13 14:21:15 -07:00
Steve Orvell
845215a3e1 Consolidate web components polyfilsl for easier maintenance and distribution. 2014-10-13 08:35:28 -07:00
Steve Orvell
affe1fed15 Initial commit 2014-10-13 08:34:02 -07:00
Addy Osmani
82c995341f Add README 2014-10-09 22:21:02 +01:00
Addy Osmani
cdbffa51cf Add package.json v0.4.2 2014-10-09 22:18:37 +01:00
Daniel Freedman
2401c64246 add bower config 2014-10-09 12:00:29 -07:00
Daniel Freedman
3b9b337dd1 seed commit 2014-10-09 11:58:52 -07:00