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

fix: provide a way to disable document patching #1221

Merged
merged 2 commits into from
May 9, 2019
Merged

fix: provide a way to disable document patching #1221

merged 2 commits into from
May 9, 2019

Conversation

ravijayaramappa
Copy link
Contributor

Details

Provide a way for core folks to bypass shadow semantics on document and document.body(shoot themselves in the foot)

Does this PR introduce a breaking change?

  • Yes
  • No

function isGlobalPatchingSkipped() {
if (isUndefined(skipGlobalPatching)) {
skipGlobalPatching =
document.body.getAttribute('data-global-patching-skipped-temporarily') ===
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

open to suggestions for the attribute name and value

const filtered = ArrayFilter.call(elements, elm => getNodeOwnerKey(elm) === ownerKey);
const filtered = ArrayFilter.call(
elements,
elm => getNodeOwnerKey(elm) === ownerKey || isGlobalPatchingSkipped()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check could go outside the ArrayFilter, but I wanted to leave it in here so that it gives us the performance cost of document patching. In effect, we execute the filtering rule and skip it. The core perf scripts will measure the cost of document patching.

function isGlobalPatchingSkipped() {
if (isUndefined(skipGlobalPatching)) {
skipGlobalPatching =
document.body.getAttribute('data-global-patching-skipped-temporarily') ===
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Liked this data attribute approach better than the url approach. This is subtle and hidden from plain sight where as the url would have been more visible and more people would notice it(and start abusing it)

Copy link
Contributor

@trevor-bliss trevor-bliss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you must.... :(

@ravijayaramappa ravijayaramappa merged commit f36bbce into salesforce:master May 9, 2019
@ravijayaramappa ravijayaramappa deleted the ravi/switch-to-disable-patching/W-6120248 branch May 9, 2019 23:50
ekashida pushed a commit that referenced this pull request May 10, 2019
* fix: provide a way to disable document patching

* fix: update names and move function out
ekashida added a commit that referenced this pull request May 10, 2019
* fix(engine): fixes #1199 and #1198 - disconnecting bug (#1202) (#1209)

* fix(engine): issues #1199 and #1198 when disconnecting

* fix(engine): PR 1202 feedback

* fix(engine): undefined elm needs protection

* fix(engine): adding tests for PR 1202

* fix(engine): test fix for native shadow

* fix: refactor mutation observer polyfill to fix memory leaks (#1200)

* fix: refactor mutation observer polyfill to fix memory leaks

* fix: address pr feedback

* test(integration-karma): migrate nested-template-event-target (#1207)

* test(integration-karma): migrate nested-template-event-target

* test(integration-karma): migrate root-listener-event-target

* test(integration-karma): migrate slotted-custome-element-event-target

* test(integration-karma): migrate nested-render-conditional

* test: increase timeout for two tests that flap in ie11

* fix(synthetic-shadow): types and bugs in preparation for final split (#1192)

* fix(synthetic-shadow): types and bugs

* fix(synthetic-shadow): activeElement only works if patch on doc

* fix(synthetic-shadow): PR 1192 feedback

* fix(synthetic-shadow): bug fix for async retargeting

* fix: prevent tabbing into subtrees with tabindex -1 (#1206)

* test: adjust tests to reproduce issue

* refactor: tabIndex setter comment

* refactor: keyboard focus handling relative to current context

* test: failing test for internal negative tabindex

* fix: correct tabbing when negative tabindex in zero tabindex

* chore: remove .only

* chore: use getOwnerDocument instead of ownerDocumentGetter

* chore: refactor test to use blocking selenium api

* test(integration-karma): migrate misc tests from integration-test (#1212)

* test(integration-karma): migrate non-composed-events-on-custom-element

* test(integration-karma): migrate events/slotted-native-element

* test(integration-karma): migrate events/window-event-listiner

* test(integration-karma): roolback migrate window-event-listener

* test(integration-karma): migrate rendering/duplicate-text-rendering

* test(integration-karma): migrate rendering/form-tag

* test(integration-karma): migrate rendering/nested-state

* test(integration-karma): migrate rendering/null-logging

* feat(babel): add filename/location to error (#1208)

* feat(babel): add filename/location to error

* wip: fix tests

* wip: return consistent location object

* wip: review comments

* fix: provide a way to disable document patching (#1221)

* fix: provide a way to disable document patching

* fix: update names and move function out
ekashida pushed a commit that referenced this pull request May 14, 2019
* fix: provide a way to disable document patching

* fix: update names and move function out
ekashida pushed a commit that referenced this pull request May 14, 2019
* fix: provide a way to disable document patching

* fix: update names and move function out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants