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

Turn out-of-module writes to module properties into calls to setters #2651

Closed
rictic opened this issue Jul 26, 2017 · 2 comments
Closed

Turn out-of-module writes to module properties into calls to setters #2651

rictic opened this issue Jul 26, 2017 · 2 comments

Comments

@rictic
Copy link
Contributor

rictic commented Jul 26, 2017

Related to Polymer/polymer#4754

@rictic
Copy link
Contributor Author

rictic commented Jul 26, 2017

e.g. in polymer/test/unit/property-effects.html we've got code like:

    Polymer.sanitizeDOMValue = sinon.spy(function(value) {
      return (value && value.toString().indexOf('javascript') >= 0) ? 'notallowed!' : value;
    });

currently that becomes:

import { sanitizeDOMValue as $sanitizeDOMValue } from '../../lib/utils/settings.js';

// ...

    $sanitizeDOMValue = sinon.spy(function(value) {
      return (value && value.toString().indexOf('javascript') >= 0) ? 'notallowed!' : value;
    });

which is illegal (as you can't write to a module export). Instead it should become:

import { sanitizeDOMValue as $sanitizeDOMValue, setSanitizeDOMValue as $setSanitizeDOMValue } from '../../lib/utils/settings.js';

// ...

    $setSanitizeDOMValue(sinon.spy(function(value) {
      return (value && value.toString().indexOf('javascript') >= 0) ? 'notallowed!' : value;
    }));

@rictic
Copy link
Contributor Author

rictic commented Aug 2, 2017

Fixed!

@rictic rictic closed this as completed Aug 2, 2017
@aomarks aomarks transferred this issue from Polymer/polymer-modulizer Jan 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants