Skip to content

Conversation

jamescrowley
Copy link

The documentation mentions mutation observers in passing but doesn't explain why or give an example of how to use them.

We probably need confirmation from the team that what I'm proposing here is considered 'supported' but this is the only way I have found to ensure we can access DOM elements that Azure AD B2C has added to the document.

For manipulating DOM elements that are loaded by Azure AD B2C
Copy link
Contributor

@jamescrowley : Thanks for your contribution! The author(s) have been notified to review your proposed change.

Copy link
Contributor

Learn Build status updates of commit b540f5a:

✅ Validation status: passed

File Status Preview URL Details
articles/active-directory-b2c/javascript-and-page-layout.md ✅Succeeded

For more details, please refer to the build report.

For any questions, please:

@ttorble
Copy link
Contributor

ttorble commented Feb 25, 2025

@garrodonnell

Can you review the proposed changes?

IMPORTANT: When the changes are ready for publication, adding a #sign-off comment is the best way to signal that the PR is ready for the review team to merge.

#label:"aq-pr-triaged"
@MicrosoftDocs/public-repo-pr-review-team

@prmerger-automator prmerger-automator bot added the aq-pr-triaged tracking label for the PR review team label Feb 25, 2025
@garrodonnell
Copy link
Contributor

Thanks for your contribution @jamescrowley. Let me discuss this with the team to get a technical review and come back to you on it.

@v-ccolin
Copy link
Contributor

I sent an email to the content owner today.

@MicrosoftDocs/public-repo-pr-review-team

@v-dirichards
Copy link
Contributor

I sent a Teams message to the content owner today.

@MicrosoftDocs/public-repo-pr-review-team

@v-dirichards
Copy link
Contributor

From the article's author:
image

@v-ccolin
Copy link
Contributor

I sent an email to the content owner today.

@MicrosoftDocs/public-repo-pr-review-team

@v-dirichards
Copy link
Contributor

I sent a Teams message to the content owner today.

@MicrosoftDocs/public-repo-pr-review-team

@ttorble
Copy link
Contributor

ttorble commented Aug 14, 2025

I sent email to the content owner today.

@MicrosoftDocs/public-repo-pr-review-team

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the Azure AD B2C JavaScript documentation by adding a practical example of using mutation observers to interact with dynamically added DOM elements. The documentation previously mentioned mutation observers in passing but lacked concrete implementation guidance.

  • Removes an overly long sentence that briefly mentioned mutation observers
  • Adds a comprehensive explanation and code example demonstrating how to use mutation observers
  • Provides practical guidance for developers who need to manipulate elements that Azure AD B2C adds dynamically

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

```javascript
<script src="my-script.js" async></script>
```
In either case, you may use inline scripts or an external script. If you wish to manipulate elements that Azure AD B2C dynamically adds to the template, you will need to use a mutation observer, as the elements will not be available when using deferred javascript execution or waiting for the DOMContentLoaded event.
Copy link
Preview

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

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

There is an extra space in 'the DOMContentLoaded' - should be 'the DOMContentLoaded'.

Suggested change
In either case, you may use inline scripts or an external script. If you wish to manipulate elements that Azure AD B2C dynamically adds to the template, you will need to use a mutation observer, as the elements will not be available when using deferred javascript execution or waiting for the DOMContentLoaded event.
In either case, you may use inline scripts or an external script. If you wish to manipulate elements that Azure AD B2C dynamically adds to the template, you will need to use a mutation observer, as the elements will not be available when using deferred javascript execution or waiting for the DOMContentLoaded event.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants