Skip to content

Instantly share code, notes, and snippets.

@O330oei
Forked from codesorter2015/mutations.html
Last active March 7, 2020 03:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save O330oei/590d041eb39690e126fac5e8e59984ad to your computer and use it in GitHub Desktop.
Save O330oei/590d041eb39690e126fac5e8e59984ad to your computer and use it in GitHub Desktop.
*.js eol=lf
*.jsx eol=lf
*.json eol=lf
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Mutation Observers</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="../video-pages/main.css">
</head>
<body>
<header>
<h1>Mutation Observers</h1>
</header>
<main>
<p title="mouseover text"><![CDATA[ this is some characterData ]]>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laborum, quam eos provident sapiente culpa corrupti, deleniti inventore, omnis recusandae repudiandae quasi soluta repellat, expedita suscipit id tenetur excepturi corporis quis.</p>
<p>Praesentium ut voluptatem corrupti itaque eveniet necessitatibus tempore cupiditate provident quod voluptas porro qui in, recusandae saepe odit, reiciendis laudantium nulla, nam perferendis nihil dolorum atque est quae. Temporibus, dolorum!</p>
<p>Quidem est neque eaque et corrupti magni, doloribus eum. Tempora impedit, veritatis labore accusantium ratione vel. Nesciunt enim quod, beatae quaerat, consectetur sequi veritatis quas dolores ex harum eligendi explicabo!</p>
</main>
<script>
let observer;
document.addEventListener('DOMContentLoaded', init);
function init(){
let p = document.querySelector('main > p'); //1st p
p.addEventListener('click', change);
let config = {
attributes: true,
attributeOldValue: true,
attributeFilter: ['data-thing', 'title', 'style'],
childList: false,
subtree: false,
characterData: false,
characterDataOldValue: false
};
/* childList, attributes, characterData */
observer = new MutationObserver(mutated);
observer.observe(p, config);
}
function change(ev){
let p = ev.currentTarget;
p.textContent = ' this is new content';
p.setAttribute('data-thing', 123);
p.title = 'NEW TITLE'
let span = document.createElement('span');
span.textContent = ' SOME SPAN TEXT';
p.appendChild(span);
}
function mutated(mutationList){
console.log( mutationList );
for(let mutation of mutationList) {
if (mutation.type == 'childList') {
console.log('A child node has been added or removed.');
}
else if (mutation.type == 'attributes') {
console.log('The ' + mutation.attributeName + ' attribute was modified.');
console.log( mutation.oldValue );
}
}
//observer.takeRecords();
observer.disconnect();
//target - Element
//addNodes - NodeList
//removedNodes - NodeList
//oldValue
//attributeName
//attributeNamespace
//nextSibling - Element / textNode
//previousSibling - Element / textNode
//type 'attributes' or 'childList'
}
</script>
</body>
</html>
@O330oei
Copy link
Author

O330oei commented Feb 20, 2020

git add . git commit -m
"Added .gitattributes to repo" git push

  • https://developer.github.com/ <title>GitHub GraphQL Schema Changes</title> 2020-02-19T08:00:00Z hubot https://github.com/hubot tag:developer.github.com,2020-02-19:/v4/changelog/2020-02-19-schema-changes/ <title type="html">GraphQL Schema Changes for 2020-02-19</title> 2020-02-19T08:00:00Z 2020-02-19T08:00:00Z

    The GraphQL schema includes these changes:

    • Type PackageType was added

    The GitHub Packages preview includes these changes:

    • Field packageType was added to object type Package
    tag:developer.github.com,2020-02-12:/v4/changelog/2020-02-12-schema-changes/ <title type="html">GraphQL Schema Changes for 2020-02-12</title> 2020-02-12T08:00:00Z 2020-02-12T08:00:00Z

    The GraphQL schema includes these changes:

    • Field deleteDeployment was added to object type Mutation
    • Type DeleteDeploymentInput was added
    • Type DeleteDeploymentPayload was added
    tag:developer.github.com,2020-02-05:/v4/changelog/2020-02-05-schema-changes/ <title type="html">GraphQL Schema Changes for 2020-02-05</title> 2020-02-05T08:00:00Z 2020-02-05T08:00:00Z

    The GraphQL schema includes these changes:

    • Type EnterpriseOrderField was removed
    • Type CollectionItemContent was removed
    • Enum value UNMARKED_AS_DUPLICATE_EVENT was added to enum PullRequestTimelineItemsItemType
    • Enum value DISCONNECTED_EVENT was added to enum PullRequestTimelineItemsItemType
    • Enum value CONNECTED_EVENT was added to enum PullRequestTimelineItemsItemType
    • Union member UnmarkedAsDuplicateEvent was added to Union type PullRequestTimelineItems
    • Union member DisconnectedEvent was added to Union type PullRequestTimelineItems
    • Union member ConnectedEvent was added to Union type PullRequestTimelineItems
    • Enum value UNMARKED_AS_DUPLICATE_EVENT was added to enum IssueTimelineItemsItemType
    • Enum value DISCONNECTED_EVENT was added to enum IssueTimelineItemsItemType
    • Enum value CONNECTED_EVENT was added to enum IssueTimelineItemsItemType
    • Union member UnmarkedAsDuplicateEvent was added to Union type IssueTimelineItems
    • Union member DisconnectedEvent was added to Union type IssueTimelineItems
    • Union member ConnectedEvent was added to Union type IssueTimelineItems
    • Input field SubmitPullRequestReviewInput.pullRequestReviewId changed type from ID! to ID
    • Input field pullRequestId was added to input object type SubmitPullRequestReviewInput
    • Input field AddPullRequestReviewCommentInput.pullRequestReviewId changed type from ID! to ID
    • Input field pullRequestId was added to input object type AddPullRequestReviewCommentInput
    • Field originalEnvironment was added to object type Deployment
    • Field latestEnvironment was added to object type Deployment
    • Field checksUrl was added to object type PullRequest
    • Field checksResourcePath was added to object type PullRequest
    • Type UnmarkedAsDuplicateEvent was added
    • Type DisconnectedEvent was added
    • Type ConnectedEvent was added

    The Checks preview includes these changes:

    • Enum value STALE was added to enum CheckConclusionState
    • Enum value SKIPPED was added to enum CheckConclusionState
    tag:developer.github.com,2020-01-09:/v4/changelog/2020-01-09-schema-changes/ <title type="html">GraphQL Schema Changes for 2020-01-09</title> 2020-01-09T08:00:00Z 2020-01-09T08:00:00Z

    The GraphQL schema includes these changes:

    • Enum value DUPLICATE was added to enum ReportedContentClassifiers
    • Field deleteBranchOnMerge was added to object type Repository
    tag:developer.github.com,2020-01-06:/v4/changelog/2020-01-06-schema-changes/ <title type="html">GraphQL Schema Changes for 2020-01-06</title> 2020-01-06T08:00:00Z 2020-01-06T08:00:00Z

    The following changes will be made to the schema:

    • On member Sponsorship.maintainer: maintainer will be removed. Use Sponsorship.sponsorable instead. Effective 2020-04-01.

    The GraphQL schema includes these changes:

    • Field sponsorable was added to object type Sponsorship
    tag:developer.github.com,2019-12-16:/v4/changelog/2019-12-16-schema-changes/ <title type="html">GraphQL Schema Changes for 2019-12-16</title> 2019-12-16T08:00:00Z 2019-12-16T08:00:00Z

    The GraphQL schema includes these changes:

    • Field actor was added to object type UpdatePullRequestPayload
    • Field actor was added to object type UpdateIssuePayload
    • Field actor was added to object type UnlockLockablePayload
    • Field actor was added to object type MergePullRequestPayload
    • Field actor was added to object type LockLockablePayload
    • Argument orderBy: LabelOrder added to field Repository.labels
    • Argument orderBy: LabelOrder added to field Issue.labels
    • Argument orderBy: LabelOrder added to field Labelable.labels
    • Argument orderBy: LabelOrder added to field PullRequest.labels
    • Type LabelOrderField was added
    • Type LabelOrder was added
    tag:developer.github.com,2019-12-11:/v4/changelog/2019-12-11-schema-changes/ <title type="html">GraphQL Schema Changes for 2019-12-11</title> 2019-12-11T08:00:00Z 2019-12-11T08:00:00Z

    The GraphQL schema includes these changes:

    • Field createdAt was added to object type RepositoryVulnerabilityAlert
    tag:developer.github.com,2019-12-05:/v4/changelog/2019-12-05-schema-changes/ <title type="html">GraphQL Schema Changes for 2019-12-05</title> 2019-12-05T08:00:00Z 2019-12-05T08:00:00Z

    The GraphQL schema includes these changes:

    • Field createdAt was added to object type SponsorsListing
    tag:developer.github.com,2019-11-25:/v4/changelog/2019-11-25-schema-changes/ <title type="html">GraphQL Schema Changes for 2019-11-25</title> 2019-11-25T08:00:00Z 2019-11-25T08:00:00Z

    The following changes will be made to the schema:

    • On member Organization.registryPackages: registryPackages will be removed. Use the PackageOwner object instead. Effective 2020-04-01.
    • On member Organization.registryPackagesForQuery: registryPackagesForQuery will be removed. Use the PackageSearch object instead. Effective 2020-04-01.
    • On member RegistryPackage.color: color will be removed. Use the Package object instead. Effective 2020-04-01.
    • On member RegistryPackage.latestVersion: latestVersion will be removed. Use the Package object instead. Effective 2020-04-01.
    • On member RegistryPackage.name: name will be removed. Use the Package object instead. Effective 2020-04-01.
    • On member RegistryPackage.nameWithOwner: nameWithOwner will be removed. Use the Package object instead. Effective 2020-04-01.
    • On member RegistryPackage.packageFileByGuid: packageFileByGuid will be removed. Use the Package object. Effective 2020-04-01.
    • On member RegistryPackage.packageFileBySha256: packageFileBySha256 will be removed. Use the Package object. Effective 2020-04-01.
    • On member RegistryPackage.packageType: packageType will be removed. Use the Package object instead. Effective 2020-04-01.
    • On member RegistryPackage.preReleaseVersions: preReleaseVersions will be removed. Use the Package object instead. Effective 2020-04-01.
    • On member RegistryPackage.registryPackageType: registryPackageType will be removed. Use the Package object instead. Effective 2020-04-01.
    • On member RegistryPackage.repository: repository will be removed. Use the Package object instead. Effective 2020-04-01.
    • On member RegistryPackage.statistics: statistics will be removed. Use the Package object instead. Effective 2020-04-01.
    • On member RegistryPackage.tags: tags will be removed. Use the Package object. Effective 2020-04-01.
    • On member RegistryPackage.topics: topics will be removed. Use the Package object. Effective 2020-04-01.
    • On member RegistryPackage.version: version will be removed. Use the Package object instead. Effective 2020-04-01.
    • On member RegistryPackage.versionByPlatform: versionByPlatform will be removed. Use the Package object instead. Effective 2020-04-01.
    • On member RegistryPackage.versionBySha256: versionBySha256 will be removed. Use the Package object instead. Effective 2020-04-01.
    • On member RegistryPackage.versions: versions will be removed. Use the Package object instead. Effective 2020-04-01.
    • On member RegistryPackage.versionsByMetadatum: versionsByMetadatum will be removed. Use the Package object instead. Effective 2020-04-01.
    • On member RegistryPackageDependency.dependencyType: dependencyType will be removed. Use the PackageDependency object instead. Effective 2020-04-01.
    • On member RegistryPackageDependency.name: name will be removed. Use the PackageDependency object instead. Effective 2020-04-01.
    • On member RegistryPackageDependency.version: version will be removed. Use the PackageDependency object instead. Effective 2020-04-01.
    • On member RegistryPackageFile.guid: guid will be removed. Use the PackageFile object instead. Effective 2020-04-01.
    • On member RegistryPackageFile.md5: md5 will be removed. Use the PackageFile object instead. Effective 2020-04-01.
    • On member RegistryPackageFile.metadataUrl: metadataUrl will be removed. Use the PackageFile object instead. Effective 2020-04-01.
    • On member RegistryPackageFile.name: name will be removed. Use the PackageFile object instead. Effective 2020-04-01.
    • On member RegistryPackageFile.packageVersion: packageVersion will be removed. Use the PackageFile object instead. Effective 2020-04-01.
    • On member RegistryPackageFile.sha1: sha1 will be removed. Use the PackageFile object instead. Effective 2020-04-01.
    • On member RegistryPackageFile.sha256: sha256 will be removed. Use the PackageFile object instead. Effective 2020-04-01.
    • On member RegistryPackageFile.size: size will be removed. Use the PackageFile object instead. Effective 2020-04-01.
    • On member RegistryPackageFile.url: url will be removed. Use the PackageFile object instead. Effective 2020-04-01.
    • On member RegistryPackageOwner.registryPackages: registryPackages will be removed. Use the PackageOwner object instead. Effective 2020-04-01.
    • On member RegistryPackageSearch.registryPackagesForQuery: registryPackagesForQuery will be removed. Use the PackageSearch object instead. Effective 2020-04-01.
    • On member RegistryPackageStatistics.downloadsThisMonth: downloadsThisMonth will be removed. Use the PackageStatistics object instead. Effective 2020-04-01.
    • On member RegistryPackageStatistics.downloadsThisWeek: downloadsThisWeek will be removed. Use the PackageStatistics object instead. Effective 2020-04-01.
    • On member RegistryPackageStatistics.downloadsThisYear: downloadsThisYear will be removed. Use the PackageStatistics object instead. Effective 2020-04-01.
    • On member RegistryPackageStatistics.downloadsToday: downloadsToday will be removed. Use the PackageStatistics object instead. Effective 2020-04-01.
    • On member RegistryPackageStatistics.downloadsTotalCount: downloadsTotalCount will be removed. Use the PackageStatistics object instead. Effective 2020-04-01.
    • On member RegistryPackageTag.name: name will be removed. Use the PackageTag object instead. Effective 2020-04-01.
    • On member RegistryPackageTag.version: version will be removed. Use the PackageTag object instead. Effective 2020-04-01.
    • On member RegistryPackageVersion.deleted: deleted will be removed. Use the PackageVersion object instead. Effective 2020-04-01.
    • On member RegistryPackageVersion.dependencies: dependencies will be removed. Use the PackageVersion object instead. Effective 2020-04-01.
    • On member RegistryPackageVersion.fileByName: fileByName will be removed. Use the PackageVersion object instead. Effective 2020-04-01.
    • On member RegistryPackageVersion.files: files will be removed. Use the PackageVersion object instead. Effective 2020-04-01.
    • On member RegistryPackageVersion.installationCommand: installationCommand will be removed. Use the PackageVersion object instead. Effective 2020-04-01.
    • On member RegistryPackageVersion.manifest: manifest will be removed. Use the PackageVersion object instead. Effective 2020-04-01.
    • On member RegistryPackageVersion.platform: platform will be removed. Use the PackageVersion object instead. Effective 2020-04-01.
    • On member RegistryPackageVersion.preRelease: preRelease will be removed. Use the PackageVersion object instead. Effective 2020-04-01.
    • On member RegistryPackageVersion.readme: readme will be removed. Use the PackageVersion object instead. Effective 2020-04-01.
    • On member RegistryPackageVersion.readmeHtml: readmeHtml will be removed. Use the PackageVersion object instead. Effective 2020-04-01.
    • On member RegistryPackageVersion.registryPackage: registryPackage will be removed. Use the PackageVersion object instead. Effective 2020-04-01.
    • On member RegistryPackageVersion.release: release will be removed. Use the PackageVersion object instead. Effective 2020-04-01.
    • On member RegistryPackageVersion.sha256: sha256 will be removed. Use the PackageVersion object instead. Effective 2020-04-01.
    • On member RegistryPackageVersion.size: size will be removed. Use the PackageVersion object instead. Effective 2020-04-01.
    • On member RegistryPackageVersion.statistics: statistics will be removed. Use the PackageVersion object instead. Effective 2020-04-01.
    • On member RegistryPackageVersion.summary: summary will be removed. Use the PackageVersion object instead. Effective 2020-04-01.
    • On member RegistryPackageVersion.updatedAt: updatedAt will be removed. Use the PackageVersion object instead. Effective 2020-04-01.
    • On member RegistryPackageVersion.version: version will be removed. Use the PackageVersion object instead. Effective 2020-04-01.
    • On member RegistryPackageVersion.viewerCanEdit: viewerCanEdit will be removed. Use the PackageVersion object instead. Effective 2020-04-01.
    • On member RegistryPackageVersionStatistics.downloadsThisMonth: downloadsThisMonth will be removed. Use the PackageVersionStatistics object instead. Effective 2020-04-01.
    • On member RegistryPackageVersionStatistics.downloadsThisWeek: downloadsThisWeek will be removed. Use the PackageVersionStatistics object instead. Effective 2020-04-01.
    • On member RegistryPackageVersionStatistics.downloadsThisYear: downloadsThisYear will be removed. Use the PackageVersionStatistics object instead. Effective 2020-04-01.
    • On member RegistryPackageVersionStatistics.downloadsToday: downloadsToday will be removed. Use the PackageVersionStatistics object instead. Effective 2020-04-01.
    • On member RegistryPackageVersionStatistics.downloadsTotalCount: downloadsTotalCount will be removed. Use the PackageVersionStatistics object instead. Effective 2020-04-01.
    • On member Repository.registryPackages: registryPackages will be removed. Use the PackageOwner object instead. Effective 2020-04-01.
    • On member Repository.registryPackagesForQuery: registryPackagesForQuery will be removed. Use the PackageSearch object instead. Effective 2020-04-01.
    • On member User.registryPackages: registryPackages will be removed. Use the PackageOwner object instead. Effective 2020-04-01.
    • On member User.registryPackagesForQuery: registryPackagesForQuery will be removed. Use the PackageSearch object instead. Effective 2020-04-01.

    The GitHub Packages preview includes these changes:

    • Field statistics was added to object type PackageVersion
    • Field statistics was added to object type Package
    • Type PackageStatistics was added
    • Type PackageVersionStatistics was added
    tag:developer.github.com,2019-11-22:/v4/changelog/2019-11-22-schema-changes/ <title type="html">GraphQL Schema Changes for 2019-11-22</title> 201

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