<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ssrivas8</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ssrivas8"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Ssrivas8"/>
	<updated>2026-04-10T07:48:05Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108270</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108270"/>
		<updated>2017-04-10T16:48:46Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Document_Object_Model DOM]&amp;lt;/span&amp;gt; standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up and Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/srivassumit/servo/wiki/Readme read me]&amp;lt;/span&amp;gt; page of the project's Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
The purpose of this project is to implement the basic functionality required to implement a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutation-observers Mutation Observer API]&amp;lt;/span&amp;gt; as defined in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org DOM]&amp;lt;/span&amp;gt; Specifications.&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;, we implemented the initial Steps as described in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/wiki/Mutation-observer-project Project Specification]&amp;lt;/span&amp;gt;. The initial implementation is merged in the original Servo Repository and the code can be found &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/commit/107ac9ab56c1a4cee3e5f9828f91ab394e3e8eee here]&amp;lt;/span&amp;gt;.&lt;br /&gt;
For the next phase of the project, we have to implement the functionality for supporting Mutation Observers.&lt;br /&gt;
Based on the Project description, we have made a Project Design, which is described in detail below.&lt;br /&gt;
&lt;br /&gt;
=='''Project Design'''==&lt;br /&gt;
&lt;br /&gt;
===High Level Design===&lt;br /&gt;
Our Project Implements the Mutation Observer API in the Mozilla's Servo Browser Engine. The High Level Design for the same is described below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Add support for mutation observer microtasks====&lt;br /&gt;
&lt;br /&gt;
*We will add a &amp;lt;code&amp;gt;mutation_observer_compound_microtask_queued&amp;lt;/code&amp;gt; member to the &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt; class. This will be used later to implement the algorithm for ''queuing a mutation observer compound microtask'' and ''notifying a mutation observer'' as described below.&lt;br /&gt;
&lt;br /&gt;
*Then, we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]&amp;lt;/span&amp;gt; by adding a new variant to the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask]&amp;lt;/span&amp;gt; enum for mutation observers. The algorithm for doing that is described below:&lt;br /&gt;
  1) If the ''mutation observer compound microtask queued'' flag is set, then return.&lt;br /&gt;
  2) Set the ''mutation observer compound microtask queued'' flag.&lt;br /&gt;
  3) &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-microtask Queue]&amp;lt;/span&amp;gt; a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/webappapis.html#compound-microtask compound microtask]&amp;lt;/span&amp;gt; which will be used to notify the mutation observers.&lt;br /&gt;
&lt;br /&gt;
*Next, we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers algorithm]&amp;lt;/span&amp;gt; using the vector of observers previously added to the &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt; class. The notify mutation observers algorithm is implemented as described below:&lt;br /&gt;
  1) Unset the ''mutation observer compound microtask queued'' flag, which was set in the previous algorithm.&lt;br /&gt;
  2) Declare ''notifyList'' to be a copy of ''unit of related similar-origin browsing contexts''' list of MutationObserver objects.&lt;br /&gt;
  3) Declare ''signalList'' to be a copy of ''unit of related similar-origin browsing contexts''' &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#signal-slot-list signal slot list]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  4) Empty the ''unit of related similar-origin browsing contexts''' signal slot list.&lt;br /&gt;
  5) For each MutationObserver object ''mo'' in ''notifyList'', we shall execute a ''compound microtask subtask'' to run these steps:&lt;br /&gt;
    1) Declare ''queue'' to contain ''mo'''s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-mo-queue record queue]&amp;lt;/span&amp;gt;.&lt;br /&gt;
    2) Empty ''mo'''s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-mo-queue record queue]&amp;lt;/span&amp;gt;.&lt;br /&gt;
    3) All transient registered observers whose observer is ''mo'' will be removed.&lt;br /&gt;
    4) If ''queue'' is non-empty, then invoke ''mo''’s callback with a list of arguments consisting of &amp;lt;code&amp;gt;queue&amp;lt;/code&amp;gt; and ''mo'', and ''mo'' as the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-callback-this-value callback this value]&amp;lt;/span&amp;gt;.&lt;br /&gt;
        If this throws an exception, then we will report the exception.&lt;br /&gt;
  6) For each ''&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-slot slot]&amp;lt;/span&amp;gt;'' in ''signalList'', an event named ''slotchange'' will be fired in the same order as it is stored in the &amp;lt;code&amp;gt;signalist&amp;lt;/code&amp;gt;,&lt;br /&gt;
      with its ''&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-event-bubbles bubbles]&amp;lt;/span&amp;gt;'' attribute set to ''true'', at ''slot''.&lt;br /&gt;
&lt;br /&gt;
====Add support for observing specific mutations====&lt;br /&gt;
*Firstly we will add a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects to &amp;lt;code&amp;gt;Node&amp;lt;/code&amp;gt; to store the Mutation Observers.&lt;br /&gt;
*Then we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationobserver-observe observe]&amp;lt;/span&amp;gt; method of MutationObserver. As per the DOM specification, the observe method has the following behaviour:&lt;br /&gt;
  1) If either ''options''’ ''attributeOldValue'' or ''attributeFilter'' is present and ''options''’ ''attributes'' is omitted, then we set the ''options''’ ''attributes''&lt;br /&gt;
    to true.&lt;br /&gt;
  2) If options’ ''characterDataOldValue'' is present and options’ ''characterData'' is omitted, then we set options’ ''characterData'' to true.&lt;br /&gt;
  3) If none of options’ ''childList'', attributes, and ''characterData'' is true, then we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-throw throw]&amp;lt;/span&amp;gt; a ''TypeError''.&lt;br /&gt;
  4) If options’ ''attributeOldValue'' is true and options’ ''attributes'' is false, then we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-throw throw]&amp;lt;/span&amp;gt; a ''TypeError''.&lt;br /&gt;
  5) If options’ ''attributeFilter'' is present and options’ ''attributes'' is false, then we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-throw throw]&amp;lt;/span&amp;gt; a ''TypeError''.&lt;br /&gt;
  6) If options’ ''characterDataOldValue'' is true and options’ ''characterData'' is false, then we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-throw throw]&amp;lt;/span&amp;gt; a ''TypeError''.&lt;br /&gt;
  7) For each &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; &amp;quot;''registered''&amp;quot; in target’s list of &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; whose '''observer''' is the context object we perform the&lt;br /&gt;
    following steps:&lt;br /&gt;
    1) We remove all &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#transient-registered-observer transient registered observers]&amp;lt;/span&amp;gt; whose '''source''' is &amp;quot;''registered''&amp;quot;.&lt;br /&gt;
    2) We also replace ''registered''’s '''options''' with options. &lt;br /&gt;
  8) Otherwise, we add a new &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; to target’s list of &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; with the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#context-object context object]&amp;lt;/span&amp;gt; as the observer and ''options''&lt;br /&gt;
    as the options, and then also, we add target to &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#context-object context object]&amp;lt;/span&amp;gt;’s list of &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-node node]&amp;lt;/span&amp;gt; on which it is registered. &lt;br /&gt;
'''Note''': Steps 7 and 8 in the above description means that we replace an existing matching entry with the new options, or add a new entry if there is no match.&lt;br /&gt;
&lt;br /&gt;
*Next, we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record algorithm]&amp;lt;/span&amp;gt;. Which is described as follows:&lt;br /&gt;
  1) Declare the ''interested'' observers initially as an empty set of &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutationobserver MutationObserver]&amp;lt;/span&amp;gt; objects optionally paired with a string.&lt;br /&gt;
  2) Declare ''nodes'' be the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor inclusive ancestors]&amp;lt;/span&amp;gt; of target.&lt;br /&gt;
  3) For each ''node'' in nodes, and then for each ''registered observer'' (with ''registered observer''’s '''options''' as ''options'') in node’s list of&lt;br /&gt;
    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; we decide:&lt;br /&gt;
    1) If none of the following are true&lt;br /&gt;
      1) ''node'' is not target and ''options''’ subtree is false&lt;br /&gt;
      2) ''type'' is &amp;quot;''attributes''&amp;quot; and ''options''’ ''attributes'' is not true&lt;br /&gt;
      3) ''type'' is &amp;quot;''attributes''&amp;quot;, ''options''’ ''attributeFilter'' is present, and ''options''’ ''attributeFilter'' does not contain name or namespace is non-null&lt;br /&gt;
      4) ''type'' is &amp;quot;''characterData''&amp;quot; and ''options''’ ''characterData'' is not true&lt;br /&gt;
      5) ''type'' is &amp;quot;''childList''&amp;quot; and ''options''’ ''childList'' is false &lt;br /&gt;
    then,:&lt;br /&gt;
      1) If ''registered observer''’s '''observer''' is not in ''interested'' observers, we append ''registered observer''’s '''observer''' to ''interested observers''.&lt;br /&gt;
      2) If either type is &amp;quot;''attributes''&amp;quot; and ''options''’ ''attributeOldValue'' is true, or type is &amp;quot;''characterData''&amp;quot; and ''options''’ &lt;br /&gt;
        ''characterDataOldValue'' is true,we set the paired string of ''registered observer''’s '''observer''' in ''interested observers'' to ''oldValue''.&lt;br /&gt;
  4) For each ''observer'' in ''interested observers'':&lt;br /&gt;
    1) Declare ''record'' to be a new &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutationrecord MutationRecord]&amp;lt;/span&amp;gt; object with its &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-type type]&amp;lt;/span&amp;gt; set to ''type'' and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-target target]&amp;lt;/span&amp;gt; set to ''target''.&lt;br /&gt;
    2) If ''name'' and ''namespace'' are given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-attributename attributeName]&amp;lt;/span&amp;gt; to ''name'', and ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-attributenamespace attributeNamespace]&amp;lt;/span&amp;gt; to ''namespace''.&lt;br /&gt;
    3) If ''addedNodes'' is given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-addednodes addedNodes]&amp;lt;/span&amp;gt; to ''addedNodes''.&lt;br /&gt;
    4) If ''removedNodes'' is given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-removednodes removedNodes]&amp;lt;/span&amp;gt; to ''removedNodes'',&lt;br /&gt;
    5) If ''previousSibling'' is given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-previoussibling previousSibling]&amp;lt;/span&amp;gt; to ''previousSibling''.&lt;br /&gt;
    6) If ''nextSibling'' is given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-nextsibling nextSibling]&amp;lt;/span&amp;gt; to ''nextSibling''.&lt;br /&gt;
    7) If ''observer'' has a paired string, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-oldvalue oldValue]&amp;lt;/span&amp;gt; to ''observer''’s paired string.&lt;br /&gt;
    8) Then, append ''record'' to ''observer''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-mo-queue record queue]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  5) &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask Queue a mutation observer compound microtask]&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
*We will make &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-change changing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing]&amp;lt;/span&amp;gt; of an attribute, queue a mutation record via the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value]&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute]&amp;lt;/span&amp;gt;, and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&amp;lt;/span&amp;gt; attributes. These changes are performed in the following steps:&lt;br /&gt;
**If we want to '''change''' an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute attribute]&amp;lt;/span&amp;gt; ''attribute'' from an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element element]&amp;lt;/span&amp;gt; ''element'' to value, we run these steps:&lt;br /&gt;
  1) &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record Queue a mutation record]&amp;lt;/span&amp;gt; of &amp;quot;attributes&amp;quot; for element with name attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;, namespace attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-namespace namespace]&amp;lt;/span&amp;gt;, and oldValue&lt;br /&gt;
     attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  2) If ''element'' is &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-custom custom]&amp;lt;/span&amp;gt;, we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/scripting.html#enqueue-a-custom-element-callback-reaction enqueue a custom element callback reaction]&amp;lt;/span&amp;gt; with ''element'', callback name &amp;quot;''attributeChangedCallback''&amp;quot;, and an&lt;br /&gt;
     argument list containing ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;, ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;, value, and ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-namespace namespace]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  3) We then run the&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-change-ext attribute change steps]&amp;lt;/span&amp;gt; with ''element'', ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;, ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;, ''value'', and ''attribute''’s  &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-namespace namespace]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  4) We set ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt; to ''value''.&lt;br /&gt;
&lt;br /&gt;
**If we want to '''append''' an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute attribute]&amp;lt;/span&amp;gt; ''attribute'' to an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element element]&amp;lt;/span&amp;gt; ''element'', we run these steps:&lt;br /&gt;
  1) We&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record]&amp;lt;/span&amp;gt; of &amp;quot;''attributes''&amp;quot; for ''element'' with name ''attribute''’s&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;, namespace ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-namespace namespace]&amp;lt;/span&amp;gt;, and ''oldValue''&lt;br /&gt;
    null.&lt;br /&gt;
  2) If ''element'' is &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-custom custom]&amp;lt;/span&amp;gt;, we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/scripting.html#enqueue-a-custom-element-callback-reaction enqueue a custom element callback reaction]&amp;lt;/span&amp;gt; with ''element'', callback name &amp;quot;''attributeChangedCallback''&amp;quot;, and an&lt;br /&gt;
     argument list containing ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;, null, ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;, and ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-namespace namespace]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  3) We then run the attribute change steps with element, attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;, null, attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;, and attribute’s namespace.&lt;br /&gt;
  4) We also &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://infra.spec.whatwg.org/#list-append append]&amp;lt;/span&amp;gt; ''attribute'' to ''element''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attribute attribute list]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  5) We then set ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-element element]&amp;lt;/span&amp;gt; to ''element''.&lt;br /&gt;
&lt;br /&gt;
**If we want to '''remove''' an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute attribute]&amp;lt;/span&amp;gt; ''attribute'' from an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element element]&amp;lt;/span&amp;gt; ''element'', we run these steps:&lt;br /&gt;
  1) We queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-namespace namespace]&amp;lt;/span&amp;gt;, and oldValue&lt;br /&gt;
     attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  2) If element is &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-custom custom]&amp;lt;/span&amp;gt;, we then &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/scripting.html#enqueue-a-custom-element-callback-reaction enqueue a custom element callback reaction]&amp;lt;/span&amp;gt; with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an&lt;br /&gt;
     argument list containing attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;, attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;, null, and attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-namespace namespace]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  3) We run the attribute change steps with element, attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;, attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;, null, and attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-namespace namespace]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  4) We then remove attribute from element’s attribute list.&lt;br /&gt;
  5) We set attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-element element]&amp;lt;/span&amp;gt; to null. &lt;br /&gt;
&lt;br /&gt;
**If we want to '''replace''' an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute attribute]&amp;lt;/span&amp;gt; ''oldAttr'' by an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute attribute]&amp;lt;/span&amp;gt; ''newAttr'' in an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element element]&amp;lt;/span&amp;gt; ''element'', run these steps:&lt;br /&gt;
  1) We&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record]&amp;lt;span&amp;gt; of &amp;quot;''attributes''&amp;quot; for ''element'' with name ''oldAttr''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;,&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-namespace namespace]&amp;lt;/span&amp;gt; ''oldAttr''’s namespace, and oldValue&lt;br /&gt;
     ''oldAttr''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  2) If element is &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-custom custom]&amp;lt;/span&amp;gt;, we then &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/scripting.html#enqueue-a-custom-element-callback-reaction enqueue a custom element callback reaction]&amp;lt;/span&amp;gt; with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an&lt;br /&gt;
     argument list containing ''oldAttr''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;, ''oldAttr''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;, ''newAttr''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;, and ''oldAttr''’s namespace.&lt;br /&gt;
  3) We run the attribute change steps with element, ''oldAttr''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;, ''oldAttr''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;, ''newAttr''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;, and ''oldAttr''’s namespace.&lt;br /&gt;
  4) We then &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://infra.spec.whatwg.org/#list-replace replace]&amp;lt;/span&amp;gt; ''oldAttr'' by ''newAttr'' in element’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attribute attribute list]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  5) We set ''oldAttr''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-element element]&amp;lt;/span&amp;gt; to null.&lt;br /&gt;
  6) We set ''newAttr''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-element element]&amp;lt;/span&amp;gt; to ''element''.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;,, our tests were written with regard to attributes, Childlist, Character data and records of a Mutation Observer. These tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The project owner from Mozilla has &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/issues/6633#issuecomment-292680210 mentioned]&amp;lt;/span&amp;gt; that the existing tests will provide enough coverage for the newly added code as well. Furthermore, it was advised to create simple tests using the following steps:&lt;br /&gt;
&lt;br /&gt;
  1) The simplest way to create a new test is to use the following command: ./mach create-wpt tests/wpt/path/to/new/test.html.&lt;br /&gt;
  2) This will create test.html in the appropriate directory using the WPT template for JavaScript tests. Tests are written using testharness.js. &lt;br /&gt;
  3) To create a new reference test instead, use the following:&lt;br /&gt;
    ./mach create-wpt --reftest tests/wpt/path/to/new/reftest.html --reference tests/wpt/path/to/reference.html&lt;br /&gt;
  4) reference.html will be created if it does not exist, and reftest.html will be created using the WPT reftest template.&lt;br /&gt;
  5) These new tests can then be run in the following manner like any other WPT test: ./mach test-wpt tests/wpt/path/to/new/test.html and &lt;br /&gt;
     ./mach test-wpt tests/wpt/path/to/new/reftest.html&lt;br /&gt;
&lt;br /&gt;
For this part of the project, our test plan is to check the following:&lt;br /&gt;
*Test the micro task for mutation observer.&lt;br /&gt;
**Check if microtask queued flag is initially unset.&lt;br /&gt;
**Check if the task returns on setting the microtask queued flag.&lt;br /&gt;
**On notifying mutation observers, check if microtask queued flag is unset.&lt;br /&gt;
**Check the size of record queue on notifying mutation observers.&lt;br /&gt;
**Check if the number of events fired is equal to number of slots in Signal list.&lt;br /&gt;
&lt;br /&gt;
*Test the observation of specific mutations:&lt;br /&gt;
**Whenever an observe method is invoked and attributeOldValue or attributeFilter is present and attributes is omitted, check if attributes is set to true.&lt;br /&gt;
**Whenever an observe method is invoked and characterDataOldValue is present and characterData is omitted, check if characterData is set to true.&lt;br /&gt;
**Whenever an observe method is invoked and a TypeError is thrown, check if atleast one of the following scenarios are true.&lt;br /&gt;
***If none of options’ childList, attributes, and characterData is true.&lt;br /&gt;
***attributeOldValue is true and attributes is false.&lt;br /&gt;
***attributeFilter is present and attributes is false.&lt;br /&gt;
***characterDataOldValue is true and characterData is false.&lt;br /&gt;
&lt;br /&gt;
===Running the Tests===&lt;br /&gt;
&lt;br /&gt;
The web-platform tests can be run by giving the following command at the root directory of the project:&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
We have Updated the corresponding test expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in the &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
Our Project follows the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern]&amp;lt;/span&amp;gt;, where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108269</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108269"/>
		<updated>2017-04-10T16:45:50Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Project Design */ added sections fo high level and technical design&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Document_Object_Model DOM]&amp;lt;/span&amp;gt; standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up and Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/srivassumit/servo/wiki/Readme read me]&amp;lt;/span&amp;gt; page of the project's Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
The purpose of this project is to implement the basic functionality required to implement a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutation-observers Mutation Observer API]&amp;lt;/span&amp;gt; as defined in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org DOM]&amp;lt;/span&amp;gt; Specifications.&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;, we implemented the initial Steps as described in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/wiki/Mutation-observer-project Project Specification]&amp;lt;/span&amp;gt;. The initial implementation is merged in the original Servo Repository and the code can be found &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/commit/107ac9ab56c1a4cee3e5f9828f91ab394e3e8eee here]&amp;lt;/span&amp;gt;.&lt;br /&gt;
For the next phase of the project, we have to implement the functionality for supporting Mutation Observers.&lt;br /&gt;
Based on the Project description, we have made a Project Design, which is described in detail below.&lt;br /&gt;
&lt;br /&gt;
=='''Project Design'''==&lt;br /&gt;
&lt;br /&gt;
===High Level Design===&lt;br /&gt;
Our Project Implements the Mutation Observer API in the Mozilla's Servo Browser Engine. The High Level Design for the same is described below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Technical Design===&lt;br /&gt;
&lt;br /&gt;
====Add support for mutation observer microtasks====&lt;br /&gt;
&lt;br /&gt;
*We will add a &amp;lt;code&amp;gt;mutation_observer_compound_microtask_queued&amp;lt;/code&amp;gt; member to the &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt; class. This will be used later to implement the algorithm for ''queuing a mutation observer compound microtask'' and ''notifying a mutation observer'' as described below.&lt;br /&gt;
&lt;br /&gt;
*Then, we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]&amp;lt;/span&amp;gt; by adding a new variant to the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask]&amp;lt;/span&amp;gt; enum for mutation observers. The algorithm for doing that is described below:&lt;br /&gt;
  1) If the ''mutation observer compound microtask queued'' flag is set, then return.&lt;br /&gt;
  2) Set the ''mutation observer compound microtask queued'' flag.&lt;br /&gt;
  3) &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-microtask Queue]&amp;lt;/span&amp;gt; a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/webappapis.html#compound-microtask compound microtask]&amp;lt;/span&amp;gt; which will be used to notify the mutation observers.&lt;br /&gt;
&lt;br /&gt;
*Next, we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers algorithm]&amp;lt;/span&amp;gt; using the vector of observers previously added to the &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt; class. The notify mutation observers algorithm is implemented as described below:&lt;br /&gt;
  1) Unset the ''mutation observer compound microtask queued'' flag, which was set in the previous algorithm.&lt;br /&gt;
  2) Declare ''notifyList'' to be a copy of ''unit of related similar-origin browsing contexts''' list of MutationObserver objects.&lt;br /&gt;
  3) Declare ''signalList'' to be a copy of ''unit of related similar-origin browsing contexts''' &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#signal-slot-list signal slot list]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  4) Empty the ''unit of related similar-origin browsing contexts''' signal slot list.&lt;br /&gt;
  5) For each MutationObserver object ''mo'' in ''notifyList'', we shall execute a ''compound microtask subtask'' to run these steps:&lt;br /&gt;
    1) Declare ''queue'' to contain ''mo'''s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-mo-queue record queue]&amp;lt;/span&amp;gt;.&lt;br /&gt;
    2) Empty ''mo'''s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-mo-queue record queue]&amp;lt;/span&amp;gt;.&lt;br /&gt;
    3) All transient registered observers whose observer is ''mo'' will be removed.&lt;br /&gt;
    4) If ''queue'' is non-empty, then invoke ''mo''’s callback with a list of arguments consisting of &amp;lt;code&amp;gt;queue&amp;lt;/code&amp;gt; and ''mo'', and ''mo'' as the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-callback-this-value callback this value]&amp;lt;/span&amp;gt;.&lt;br /&gt;
        If this throws an exception, then we will report the exception.&lt;br /&gt;
  6) For each ''&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-slot slot]&amp;lt;/span&amp;gt;'' in ''signalList'', an event named ''slotchange'' will be fired in the same order as it is stored in the &amp;lt;code&amp;gt;signalist&amp;lt;/code&amp;gt;,&lt;br /&gt;
      with its ''&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-event-bubbles bubbles]&amp;lt;/span&amp;gt;'' attribute set to ''true'', at ''slot''.&lt;br /&gt;
&lt;br /&gt;
====Add support for observing specific mutations====&lt;br /&gt;
*Firstly we will add a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects to &amp;lt;code&amp;gt;Node&amp;lt;/code&amp;gt; to store the Mutation Observers.&lt;br /&gt;
*Then we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationobserver-observe observe]&amp;lt;/span&amp;gt; method of MutationObserver. As per the DOM specification, the observe method has the following behaviour:&lt;br /&gt;
  1) If either ''options''’ ''attributeOldValue'' or ''attributeFilter'' is present and ''options''’ ''attributes'' is omitted, then we set the ''options''’ ''attributes''&lt;br /&gt;
    to true.&lt;br /&gt;
  2) If options’ ''characterDataOldValue'' is present and options’ ''characterData'' is omitted, then we set options’ ''characterData'' to true.&lt;br /&gt;
  3) If none of options’ ''childList'', attributes, and ''characterData'' is true, then we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-throw throw]&amp;lt;/span&amp;gt; a ''TypeError''.&lt;br /&gt;
  4) If options’ ''attributeOldValue'' is true and options’ ''attributes'' is false, then we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-throw throw]&amp;lt;/span&amp;gt; a ''TypeError''.&lt;br /&gt;
  5) If options’ ''attributeFilter'' is present and options’ ''attributes'' is false, then we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-throw throw]&amp;lt;/span&amp;gt; a ''TypeError''.&lt;br /&gt;
  6) If options’ ''characterDataOldValue'' is true and options’ ''characterData'' is false, then we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-throw throw]&amp;lt;/span&amp;gt; a ''TypeError''.&lt;br /&gt;
  7) For each &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; &amp;quot;''registered''&amp;quot; in target’s list of &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; whose '''observer''' is the context object we perform the&lt;br /&gt;
    following steps:&lt;br /&gt;
    1) We remove all &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#transient-registered-observer transient registered observers]&amp;lt;/span&amp;gt; whose '''source''' is &amp;quot;''registered''&amp;quot;.&lt;br /&gt;
    2) We also replace ''registered''’s '''options''' with options. &lt;br /&gt;
  8) Otherwise, we add a new &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; to target’s list of &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; with the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#context-object context object]&amp;lt;/span&amp;gt; as the observer and ''options''&lt;br /&gt;
    as the options, and then also, we add target to &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#context-object context object]&amp;lt;/span&amp;gt;’s list of &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-node node]&amp;lt;/span&amp;gt; on which it is registered. &lt;br /&gt;
'''Note''': Steps 7 and 8 in the above description means that we replace an existing matching entry with the new options, or add a new entry if there is no match.&lt;br /&gt;
&lt;br /&gt;
*Next, we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record algorithm]&amp;lt;/span&amp;gt;. Which is described as follows:&lt;br /&gt;
  1) Declare the ''interested'' observers initially as an empty set of &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutationobserver MutationObserver]&amp;lt;/span&amp;gt; objects optionally paired with a string.&lt;br /&gt;
  2) Declare ''nodes'' be the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor inclusive ancestors]&amp;lt;/span&amp;gt; of target.&lt;br /&gt;
  3) For each ''node'' in nodes, and then for each ''registered observer'' (with ''registered observer''’s '''options''' as ''options'') in node’s list of&lt;br /&gt;
    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; we decide:&lt;br /&gt;
    1) If none of the following are true&lt;br /&gt;
      1) ''node'' is not target and ''options''’ subtree is false&lt;br /&gt;
      2) ''type'' is &amp;quot;''attributes''&amp;quot; and ''options''’ ''attributes'' is not true&lt;br /&gt;
      3) ''type'' is &amp;quot;''attributes''&amp;quot;, ''options''’ ''attributeFilter'' is present, and ''options''’ ''attributeFilter'' does not contain name or namespace is non-null&lt;br /&gt;
      4) ''type'' is &amp;quot;''characterData''&amp;quot; and ''options''’ ''characterData'' is not true&lt;br /&gt;
      5) ''type'' is &amp;quot;''childList''&amp;quot; and ''options''’ ''childList'' is false &lt;br /&gt;
    then,:&lt;br /&gt;
      1) If ''registered observer''’s '''observer''' is not in ''interested'' observers, we append ''registered observer''’s '''observer''' to ''interested observers''.&lt;br /&gt;
      2) If either type is &amp;quot;''attributes''&amp;quot; and ''options''’ ''attributeOldValue'' is true, or type is &amp;quot;''characterData''&amp;quot; and ''options''’ &lt;br /&gt;
        ''characterDataOldValue'' is true,we set the paired string of ''registered observer''’s '''observer''' in ''interested observers'' to ''oldValue''.&lt;br /&gt;
  4) For each ''observer'' in ''interested observers'':&lt;br /&gt;
    1) Declare ''record'' to be a new &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutationrecord MutationRecord]&amp;lt;/span&amp;gt; object with its &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-type type]&amp;lt;/span&amp;gt; set to ''type'' and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-target target]&amp;lt;/span&amp;gt; set to ''target''.&lt;br /&gt;
    2) If ''name'' and ''namespace'' are given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-attributename attributeName]&amp;lt;/span&amp;gt; to ''name'', and ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-attributenamespace attributeNamespace]&amp;lt;/span&amp;gt; to ''namespace''.&lt;br /&gt;
    3) If ''addedNodes'' is given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-addednodes addedNodes]&amp;lt;/span&amp;gt; to ''addedNodes''.&lt;br /&gt;
    4) If ''removedNodes'' is given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-removednodes removedNodes]&amp;lt;/span&amp;gt; to ''removedNodes'',&lt;br /&gt;
    5) If ''previousSibling'' is given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-previoussibling previousSibling]&amp;lt;/span&amp;gt; to ''previousSibling''.&lt;br /&gt;
    6) If ''nextSibling'' is given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-nextsibling nextSibling]&amp;lt;/span&amp;gt; to ''nextSibling''.&lt;br /&gt;
    7) If ''observer'' has a paired string, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-oldvalue oldValue]&amp;lt;/span&amp;gt; to ''observer''’s paired string.&lt;br /&gt;
    8) Then, append ''record'' to ''observer''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-mo-queue record queue]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  5) &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask Queue a mutation observer compound microtask]&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
*We will make &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-change changing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing]&amp;lt;/span&amp;gt; of an attribute, queue a mutation record via the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value]&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute]&amp;lt;/span&amp;gt;, and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&amp;lt;/span&amp;gt; attributes. These changes are performed in the following steps:&lt;br /&gt;
**If we want to '''change''' an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute attribute]&amp;lt;/span&amp;gt; ''attribute'' from an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element element]&amp;lt;/span&amp;gt; ''element'' to value, we run these steps:&lt;br /&gt;
  1) &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record Queue a mutation record]&amp;lt;/span&amp;gt; of &amp;quot;attributes&amp;quot; for element with name attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;, namespace attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-namespace namespace]&amp;lt;/span&amp;gt;, and oldValue&lt;br /&gt;
     attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  2) If ''element'' is &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-custom custom]&amp;lt;/span&amp;gt;, we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/scripting.html#enqueue-a-custom-element-callback-reaction enqueue a custom element callback reaction]&amp;lt;/span&amp;gt; with ''element'', callback name &amp;quot;''attributeChangedCallback''&amp;quot;, and an&lt;br /&gt;
     argument list containing ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;, ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;, value, and ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-namespace namespace]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  3) We then run the&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-change-ext attribute change steps]&amp;lt;/span&amp;gt; with ''element'', ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;, ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;, ''value'', and ''attribute''’s  &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-namespace namespace]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  4) We set ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt; to ''value''.&lt;br /&gt;
&lt;br /&gt;
**If we want to '''append''' an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute attribute]&amp;lt;/span&amp;gt; ''attribute'' to an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element element]&amp;lt;/span&amp;gt; ''element'', we run these steps:&lt;br /&gt;
  1) We&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record]&amp;lt;/span&amp;gt; of &amp;quot;''attributes''&amp;quot; for ''element'' with name ''attribute''’s&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;, namespace ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-namespace namespace]&amp;lt;/span&amp;gt;, and ''oldValue''&lt;br /&gt;
    null.&lt;br /&gt;
  2) If ''element'' is &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-custom custom]&amp;lt;/span&amp;gt;, we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/scripting.html#enqueue-a-custom-element-callback-reaction enqueue a custom element callback reaction]&amp;lt;/span&amp;gt; with ''element'', callback name &amp;quot;''attributeChangedCallback''&amp;quot;, and an&lt;br /&gt;
     argument list containing ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;, null, ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;, and ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-namespace namespace]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  3) We then run the attribute change steps with element, attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;, null, attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;, and attribute’s namespace.&lt;br /&gt;
  4) We also &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://infra.spec.whatwg.org/#list-append append]&amp;lt;/span&amp;gt; ''attribute'' to ''element''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attribute attribute list]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  5) We then set ''attribute''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-element element]&amp;lt;/span&amp;gt; to ''element''.&lt;br /&gt;
&lt;br /&gt;
**If we want to '''remove''' an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute attribute]&amp;lt;/span&amp;gt; ''attribute'' from an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element element]&amp;lt;/span&amp;gt; ''element'', we run these steps:&lt;br /&gt;
  1) We queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-namespace namespace]&amp;lt;/span&amp;gt;, and oldValue&lt;br /&gt;
     attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  2) If element is &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-custom custom]&amp;lt;/span&amp;gt;, we then &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/scripting.html#enqueue-a-custom-element-callback-reaction enqueue a custom element callback reaction]&amp;lt;/span&amp;gt; with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an&lt;br /&gt;
     argument list containing attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;, attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;, null, and attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-namespace namespace]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  3) We run the attribute change steps with element, attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;, attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;, null, and attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-namespace namespace]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  4) We then remove attribute from element’s attribute list.&lt;br /&gt;
  5) We set attribute’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-element element]&amp;lt;/span&amp;gt; to null. &lt;br /&gt;
&lt;br /&gt;
**If we want to '''replace''' an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute attribute]&amp;lt;/span&amp;gt; ''oldAttr'' by an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute attribute]&amp;lt;/span&amp;gt; ''newAttr'' in an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element element]&amp;lt;/span&amp;gt; ''element'', run these steps:&lt;br /&gt;
  1) We&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record]&amp;lt;span&amp;gt; of &amp;quot;''attributes''&amp;quot; for ''element'' with name ''oldAttr''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;,&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-namespace namespace]&amp;lt;/span&amp;gt; ''oldAttr''’s namespace, and oldValue&lt;br /&gt;
     ''oldAttr''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  2) If element is &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-custom custom]&amp;lt;/span&amp;gt;, we then &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/scripting.html#enqueue-a-custom-element-callback-reaction enqueue a custom element callback reaction]&amp;lt;/span&amp;gt; with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an&lt;br /&gt;
     argument list containing ''oldAttr''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;, ''oldAttr''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;, ''newAttr''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;, and ''oldAttr''’s namespace.&lt;br /&gt;
  3) We run the attribute change steps with element, ''oldAttr''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-local-name local name]&amp;lt;/span&amp;gt;, ''oldAttr''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;, ''newAttr''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-value value]&amp;lt;/span&amp;gt;, and ''oldAttr''’s namespace.&lt;br /&gt;
  4) We then &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://infra.spec.whatwg.org/#list-replace replace]&amp;lt;/span&amp;gt; ''oldAttr'' by ''newAttr'' in element’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attribute attribute list]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  5) We set ''oldAttr''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-element element]&amp;lt;/span&amp;gt; to null.&lt;br /&gt;
  6) We set ''newAttr''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute-element element]&amp;lt;/span&amp;gt; to ''element''.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;,, our tests were written with regard to attributes, Childlist, Character data and records of a Mutation Observer. These tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The project owner from Mozilla has &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/issues/6633#issuecomment-292680210 mentioned]&amp;lt;/span&amp;gt; that the existing tests will provide enough coverage for the newly added code as well. Furthermore, it was advised to create simple tests using the following steps:&lt;br /&gt;
&lt;br /&gt;
  1) The simplest way to create a new test is to use the following command: ./mach create-wpt tests/wpt/path/to/new/test.html.&lt;br /&gt;
  2) This will create test.html in the appropriate directory using the WPT template for JavaScript tests. Tests are written using testharness.js. &lt;br /&gt;
  3) To create a new reference test instead, use the following: ./mach create-wpt --reftest tests/wpt/path/to/new/reftest.html --reference tests/wpt/path/to/reference.html&lt;br /&gt;
  4) reference.html will be created if it does not exist, and reftest.html will be created using the WPT reftest template.&lt;br /&gt;
  5) These new tests can then be run in the following manner like any other WPT test: ./mach test-wpt tests/wpt/path/to/new/test.html and &lt;br /&gt;
     ./mach test-wpt tests/wpt/path/to/new/reftest.html&lt;br /&gt;
&lt;br /&gt;
For this part of the project, our test plan is to check the following:&lt;br /&gt;
*Test the micro task for mutation observer.&lt;br /&gt;
**Check if microtask queued flag is initially unset.&lt;br /&gt;
**Check if the task returns on setting the microtask queued flag.&lt;br /&gt;
**On notifying mutation observers, check if microtask queued flag is unset.&lt;br /&gt;
**Check the size of record queue on notifying mutation observers.&lt;br /&gt;
**Check if the number of events fired is equal to number of slots in Signal list.&lt;br /&gt;
&lt;br /&gt;
*Test the observation of specific mutations:&lt;br /&gt;
**Whenever an observe method is invoked and attributeOldValue or attributeFilter is present and attributes is omitted, check if attributes is set to true.&lt;br /&gt;
**Whenever an observe method is invoked and characterDataOldValue is present and characterData is omitted, check if characterData is set to true.&lt;br /&gt;
**Whenever an observe method is invoked and a TypeError is thrown, check if atleast one of the following scenarios are true.&lt;br /&gt;
***If none of options’ childList, attributes, and characterData is true.&lt;br /&gt;
***attributeOldValue is true and attributes is false.&lt;br /&gt;
***attributeFilter is present and attributes is false.&lt;br /&gt;
***characterDataOldValue is true and characterData is false.&lt;br /&gt;
&lt;br /&gt;
The web-platform tests can be run by giving the following command at the root directory of the project:&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
We have Updated the corresponding test expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in the &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
Our Project follows the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern]&amp;lt;/span&amp;gt;, where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017&amp;diff=108261</id>
		<title>CSC/ECE 517 Spring 2017</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017&amp;diff=108261"/>
		<updated>2017-04-08T05:37:06Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: added link for M1702&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Final Project Design Document==&lt;br /&gt;
*[[CSC/ECE 517 Spring 2017 E1733 Text metrics]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API Design]]&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108139</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108139"/>
		<updated>2017-04-08T00:33:07Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Add support for observing specific mutations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Document_Object_Model DOM]&amp;lt;/span&amp;gt; standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up and Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/srivassumit/servo/wiki/Readme read me]&amp;lt;/span&amp;gt; page of the project's Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
The purpose of this project is to implement the basic functionality required to implement a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutation-observers Mutation Observer API]&amp;lt;/span&amp;gt; as defined in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org DOM]&amp;lt;/span&amp;gt; Specifications.&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;, we implemented the initial Steps as described in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/wiki/Mutation-observer-project Project Specification]&amp;lt;/span&amp;gt;. The initial implementation is merged in the original Servo Repository and the code can be found &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/commit/107ac9ab56c1a4cee3e5f9828f91ab394e3e8eee here]&amp;lt;/span&amp;gt;.&lt;br /&gt;
For the next phase of the project, we have to implement the functionality for supporting Mutation Observers.&lt;br /&gt;
Based on the Project description, we have made a Project Design, which is described in detail below.&lt;br /&gt;
&lt;br /&gt;
=='''Project Design'''==&lt;br /&gt;
&lt;br /&gt;
===Add support for mutation observer microtasks===&lt;br /&gt;
&lt;br /&gt;
*We will add a &amp;lt;code&amp;gt;mutation_observer_compound_microtask_queued&amp;lt;/code&amp;gt; member to the &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt; class. This will be used later to implement the algorithm for ''queuing a mutation observer compound microtask'' and ''notifying a mutation observer'' as described below.&lt;br /&gt;
&lt;br /&gt;
*Then, we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]&amp;lt;/span&amp;gt; by adding a new variant to the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask]&amp;lt;/span&amp;gt; enum for mutation observers. The algorithm for doing that is described below:&lt;br /&gt;
  1) If the ''mutation observer compound microtask queued'' flag is set, then return.&lt;br /&gt;
  2) Set the ''mutation observer compound microtask queued'' flag.&lt;br /&gt;
  3) &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-microtask Queue]&amp;lt;/span&amp;gt; a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/webappapis.html#compound-microtask compound microtask]&amp;lt;/span&amp;gt; which will be used to notify the mutation observers.&lt;br /&gt;
&lt;br /&gt;
*Next, we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers algorithm]&amp;lt;/span&amp;gt; using the vector of observers previously added to the &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt; class. The notify mutation observers algorithm is implemented as described below:&lt;br /&gt;
  1) Unset the ''mutation observer compound microtask queued'' flag, which was set in the previous algorithm.&lt;br /&gt;
  2) Declare ''notifyList'' to be a copy of ''unit of related similar-origin browsing contexts''' list of MutationObserver objects.&lt;br /&gt;
  3) Declare ''signalList'' to be a copy of ''unit of related similar-origin browsing contexts''' &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#signal-slot-list signal slot list]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  4) Empty the ''unit of related similar-origin browsing contexts''' signal slot list.&lt;br /&gt;
  5) For each MutationObserver object ''mo'' in ''notifyList'', we shall execute a ''compound microtask subtask'' to run these steps:&lt;br /&gt;
    1) Declare ''queue'' to contain ''mo'''s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-mo-queue record queue]&amp;lt;/span&amp;gt;.&lt;br /&gt;
    2) Empty ''mo'''s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-mo-queue record queue]&amp;lt;/span&amp;gt;.&lt;br /&gt;
    3) All transient registered observers whose observer is ''mo'' will be removed.&lt;br /&gt;
    4) If ''queue'' is non-empty, then invoke ''mo''’s callback with a list of arguments consisting of &amp;lt;code&amp;gt;queue&amp;lt;/code&amp;gt; and ''mo'', and ''mo'' as the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-callback-this-value callback this value]&amp;lt;/span&amp;gt;.&lt;br /&gt;
        If this throws an exception, then we will report the exception.&lt;br /&gt;
  6) For each ''&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-slot slot]&amp;lt;/span&amp;gt;'' in ''signalList'', an event named ''slotchange'' will be fired in the same order as it is stored in the &amp;lt;code&amp;gt;signalist&amp;lt;/code&amp;gt;,&lt;br /&gt;
      with its ''&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-event-bubbles bubbles]&amp;lt;/span&amp;gt;'' attribute set to ''true'', at ''slot''.&lt;br /&gt;
&lt;br /&gt;
===Add support for observing specific mutations===&lt;br /&gt;
*Firstly we will add a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects to &amp;lt;code&amp;gt;Node&amp;lt;/code&amp;gt; to store the Mutation Observers.&lt;br /&gt;
*Then we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationobserver-observe observe]&amp;lt;/span&amp;gt; method of MutationObserver. As per the DOM specification, the observe method has the following behaviour:&lt;br /&gt;
  1) If either ''options''’ ''attributeOldValue'' or ''attributeFilter'' is present and ''options''’ ''attributes'' is omitted, then we set the ''options''’ ''attributes''&lt;br /&gt;
    to true.&lt;br /&gt;
  2) If options’ ''characterDataOldValue'' is present and options’ ''characterData'' is omitted, then we set options’ ''characterData'' to true.&lt;br /&gt;
  3) If none of options’ ''childList'', attributes, and ''characterData'' is true, then we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-throw throw]&amp;lt;/span&amp;gt; a ''TypeError''.&lt;br /&gt;
  4) If options’ ''attributeOldValue'' is true and options’ ''attributes'' is false, then we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-throw throw]&amp;lt;/span&amp;gt; a ''TypeError''.&lt;br /&gt;
  5) If options’ ''attributeFilter'' is present and options’ ''attributes'' is false, then we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-throw throw]&amp;lt;/span&amp;gt; a ''TypeError''.&lt;br /&gt;
  6) If options’ ''characterDataOldValue'' is true and options’ ''characterData'' is false, then we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-throw throw]&amp;lt;/span&amp;gt; a ''TypeError''.&lt;br /&gt;
  7) For each &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; &amp;quot;''registered''&amp;quot; in target’s list of &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; whose '''observer''' is the context object we perform the&lt;br /&gt;
    following steps:&lt;br /&gt;
    1) We remove all &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#transient-registered-observer transient registered observers]&amp;lt;/span&amp;gt; whose '''source''' is &amp;quot;''registered''&amp;quot;.&lt;br /&gt;
    2) We also replace ''registered''’s '''options''' with options. &lt;br /&gt;
  8) Otherwise, we add a new &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; to target’s list of &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; with the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#context-object context object]&amp;lt;/span&amp;gt; as the observer and ''options''&lt;br /&gt;
    as the options, and then also, we add target to &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#context-object context object]&amp;lt;/span&amp;gt;’s list of &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-node node]&amp;lt;/span&amp;gt; on which it is registered. &lt;br /&gt;
'''Note''': Steps 7 and 8 in the above description means that we replace an existing matching entry with the new options, or add a new entry if there is no match.&lt;br /&gt;
&lt;br /&gt;
*Next, we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record algorithm]&amp;lt;/span&amp;gt;. Which is described as follows:&lt;br /&gt;
  1) Declare the ''interested'' observers initially as an empty set of &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutationobserver MutationObserver]&amp;lt;/span&amp;gt; objects optionally paired with a string.&lt;br /&gt;
  2) Declare ''nodes'' be the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor inclusive ancestors]&amp;lt;/span&amp;gt; of target.&lt;br /&gt;
  3) For each ''node'' in nodes, and then for each ''registered observer'' (with ''registered observer''’s '''options''' as ''options'') in node’s list of&lt;br /&gt;
    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; we decide:&lt;br /&gt;
    1) If none of the following are true&lt;br /&gt;
      * ''node'' is not target and ''options''’ subtree is false&lt;br /&gt;
      * ''type'' is &amp;quot;''attributes''&amp;quot; and ''options''’ ''attributes'' is not true&lt;br /&gt;
      * ''type'' is &amp;quot;''attributes''&amp;quot;, ''options''’ ''attributeFilter'' is present, and ''options''’ ''attributeFilter'' does not contain name or namespace is non-null&lt;br /&gt;
      * ''type'' is &amp;quot;''characterData''&amp;quot; and ''options''’ ''characterData'' is not true&lt;br /&gt;
      * ''type'' is &amp;quot;''childList''&amp;quot; and ''options''’ ''childList'' is false &lt;br /&gt;
    then,:&lt;br /&gt;
      1) If ''registered observer''’s '''observer''' is not in ''interested'' observers, we append ''registered observer''’s '''observer''' to ''interested observers''.&lt;br /&gt;
      2) If either type is &amp;quot;''attributes''&amp;quot; and ''options''’ ''attributeOldValue'' is true, or type is &amp;quot;''characterData''&amp;quot; and ''options''’ &lt;br /&gt;
        ''characterDataOldValue'' is true,we set the paired string of ''registered observer''’s '''observer''' in ''interested observers'' to ''oldValue''.&lt;br /&gt;
  4) For each ''observer'' in ''interested observers'':&lt;br /&gt;
    1) Declare ''record'' to be a new &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutationrecord MutationRecord]&amp;lt;/span&amp;gt; object with its &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-type type]&amp;lt;/span&amp;gt; set to ''type'' and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-target target]&amp;lt;/span&amp;gt; set to ''target''.&lt;br /&gt;
    2) If ''name'' and ''namespace'' are given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-attributename attributeName]&amp;lt;/span&amp;gt; to ''name'', and ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-attributenamespace attributeNamespace]&amp;lt;/span&amp;gt; to ''namespace''.&lt;br /&gt;
    3) If ''addedNodes'' is given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-addednodes addedNodes]&amp;lt;/span&amp;gt; to ''addedNodes''.&lt;br /&gt;
    4) If ''removedNodes'' is given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-removednodes removedNodes]&amp;lt;/span&amp;gt; to ''removedNodes'',&lt;br /&gt;
    5) If ''previousSibling'' is given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-previoussibling previousSibling]&amp;lt;/span&amp;gt; to ''previousSibling''.&lt;br /&gt;
    6) If ''nextSibling'' is given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-nextsibling nextSibling]&amp;lt;/span&amp;gt; to ''nextSibling''.&lt;br /&gt;
    7) If ''observer'' has a paired string, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-oldvalue oldValue]&amp;lt;/span&amp;gt; to ''observer''’s paired string.&lt;br /&gt;
    8) Then, append ''record'' to ''observer''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-mo-queue record queue]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  5) &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask Queue a mutation observer compound microtask]&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
*We will make &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-change changing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing]&amp;lt;/span&amp;gt; of an attribute, queue a mutation record via the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value]&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute]&amp;lt;/span&amp;gt;, and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&amp;lt;/span&amp;gt; attributes. These changes are performed in the following steps:&lt;br /&gt;
**If we want to '''change''' an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute attribute]&amp;lt;/span&amp;gt; ''attribute'' from an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element element]&amp;lt;/span&amp;gt; ''element'' to value, we run these steps:&lt;br /&gt;
  * Queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue attribute’s value.&lt;br /&gt;
  * If element is custom, we enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, attribute’s value, value, and attribute’s namespace.&lt;br /&gt;
  * We then run the attribute change steps with element, attribute’s local name, attribute’s value, value, and attribute’s namespace.&lt;br /&gt;
  * We set attribute’s value to value.&lt;br /&gt;
**If we want to '''append''' an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute attribute]&amp;lt;/span&amp;gt; ''attribute'' to an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element element]&amp;lt;/span&amp;gt; ''element'', we run these steps:&lt;br /&gt;
  * We queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue null.&lt;br /&gt;
  * If element is custom, we enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, null, attribute’s value, and attribute’s namespace.&lt;br /&gt;
  * We then run the attribute change steps with element, attribute’s local name, null, attribute’s value, and attribute’s namespace.&lt;br /&gt;
  * We also append attribute to element’s attribute list.&lt;br /&gt;
  * We then set attribute’s element to element. &lt;br /&gt;
**If we want to '''remove''' an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute attribute]&amp;lt;/span&amp;gt; ''attribute'' from an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element element]&amp;lt;/span&amp;gt; ''element'', we run these steps:&lt;br /&gt;
  * We queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue attribute’s value.&lt;br /&gt;
  * If element is custom, we then enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, attribute’s value, null, and attribute’s namespace.&lt;br /&gt;
  * We run the attribute change steps with element, attribute’s local name, attribute’s value, null, and attribute’s namespace.&lt;br /&gt;
  * We then remove attribute from element’s attribute list.&lt;br /&gt;
  * We set attribute’s element to null. &lt;br /&gt;
**If we want to '''replace''' an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute attribute]&amp;lt;/span&amp;gt; ''oldAttr'' by an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute attribute]&amp;lt;/span&amp;gt; ''newAttr'' in an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element element]&amp;lt;/span&amp;gt; ''element'', run these steps:&lt;br /&gt;
  * We queue a mutation record of &amp;quot;attributes&amp;quot; for element with name oldAttr’s local name, namespace oldAttr’s namespace, and oldValue oldAttr’s value.&lt;br /&gt;
  * If element is custom, we then enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing oldAttr’s local name, oldAttr’s value, newAttr’s value, and oldAttr’s namespace.&lt;br /&gt;
  * We run the attribute change steps with element, oldAttr’s local name, oldAttr’s value, newAttr’s value, and oldAttr’s namespace.&lt;br /&gt;
  * We then replace oldAttr by newAttr in element’s attribute list.&lt;br /&gt;
  * We set oldAttr’s element to null.&lt;br /&gt;
  * We set newAttr’s element to element.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;,, our tests were written with regard to attributes, Childlist, Character data and records of a Mutation Observer. These tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
For this part of the project, our test plan is to check the following:&lt;br /&gt;
*Test the micro task for mutation observer.&lt;br /&gt;
**Check if microtask queued flag is initially unset.&lt;br /&gt;
**Check if the task returns on setting the microtask queued flag.&lt;br /&gt;
**On notifying mutation observers, check if microtask queued flag is unset.&lt;br /&gt;
**Check the size of record queue on notifying mutation observers.&lt;br /&gt;
**Check if the number of events fired is equal to number of slots in Signal list.&lt;br /&gt;
&lt;br /&gt;
*Test the observation of specific mutations:&lt;br /&gt;
**Whenever an observe method is invoked and attributeOldValue or attributeFilter is present and attributes is omitted, check if attributes is set to true.&lt;br /&gt;
**Whenever an observe method is invoked and characterDataOldValue is present and characterData is omitted, check if characterData is set to true.&lt;br /&gt;
**Whenever an observe method is invoked and a TypeError is thrown, check if atleast one of the following scenarios are true.&lt;br /&gt;
***If none of options’ childList, attributes, and characterData is true.&lt;br /&gt;
***attributeOldValue is true and attributes is false.&lt;br /&gt;
***attributeFilter is present and attributes is false.&lt;br /&gt;
***characterDataOldValue is true and characterData is false.&lt;br /&gt;
&lt;br /&gt;
The web-platform tests can be run by giving the following command at the root directory of the project:&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
We have Updated the corresponding test expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in the &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
Our Project follows the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern]&amp;lt;/span&amp;gt;, where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108138</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108138"/>
		<updated>2017-04-08T00:30:23Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Add support for observing specific mutations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Document_Object_Model DOM]&amp;lt;/span&amp;gt; standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up and Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/srivassumit/servo/wiki/Readme read me]&amp;lt;/span&amp;gt; page of the project's Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
The purpose of this project is to implement the basic functionality required to implement a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutation-observers Mutation Observer API]&amp;lt;/span&amp;gt; as defined in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org DOM]&amp;lt;/span&amp;gt; Specifications.&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;, we implemented the initial Steps as described in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/wiki/Mutation-observer-project Project Specification]&amp;lt;/span&amp;gt;. The initial implementation is merged in the original Servo Repository and the code can be found &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/commit/107ac9ab56c1a4cee3e5f9828f91ab394e3e8eee here]&amp;lt;/span&amp;gt;.&lt;br /&gt;
For the next phase of the project, we have to implement the functionality for supporting Mutation Observers.&lt;br /&gt;
Based on the Project description, we have made a Project Design, which is described in detail below.&lt;br /&gt;
&lt;br /&gt;
=='''Project Design'''==&lt;br /&gt;
&lt;br /&gt;
===Add support for mutation observer microtasks===&lt;br /&gt;
&lt;br /&gt;
*We will add a &amp;lt;code&amp;gt;mutation_observer_compound_microtask_queued&amp;lt;/code&amp;gt; member to the &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt; class. This will be used later to implement the algorithm for ''queuing a mutation observer compound microtask'' and ''notifying a mutation observer'' as described below.&lt;br /&gt;
&lt;br /&gt;
*Then, we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]&amp;lt;/span&amp;gt; by adding a new variant to the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask]&amp;lt;/span&amp;gt; enum for mutation observers. The algorithm for doing that is described below:&lt;br /&gt;
  1) If the ''mutation observer compound microtask queued'' flag is set, then return.&lt;br /&gt;
  2) Set the ''mutation observer compound microtask queued'' flag.&lt;br /&gt;
  3) &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-microtask Queue]&amp;lt;/span&amp;gt; a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/webappapis.html#compound-microtask compound microtask]&amp;lt;/span&amp;gt; which will be used to notify the mutation observers.&lt;br /&gt;
&lt;br /&gt;
*Next, we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers algorithm]&amp;lt;/span&amp;gt; using the vector of observers previously added to the &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt; class. The notify mutation observers algorithm is implemented as described below:&lt;br /&gt;
  1) Unset the ''mutation observer compound microtask queued'' flag, which was set in the previous algorithm.&lt;br /&gt;
  2) Declare ''notifyList'' to be a copy of ''unit of related similar-origin browsing contexts''' list of MutationObserver objects.&lt;br /&gt;
  3) Declare ''signalList'' to be a copy of ''unit of related similar-origin browsing contexts''' &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#signal-slot-list signal slot list]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  4) Empty the ''unit of related similar-origin browsing contexts''' signal slot list.&lt;br /&gt;
  5) For each MutationObserver object ''mo'' in ''notifyList'', we shall execute a ''compound microtask subtask'' to run these steps:&lt;br /&gt;
    1) Declare ''queue'' to contain ''mo'''s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-mo-queue record queue]&amp;lt;/span&amp;gt;.&lt;br /&gt;
    2) Empty ''mo'''s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-mo-queue record queue]&amp;lt;/span&amp;gt;.&lt;br /&gt;
    3) All transient registered observers whose observer is ''mo'' will be removed.&lt;br /&gt;
    4) If ''queue'' is non-empty, then invoke ''mo''’s callback with a list of arguments consisting of &amp;lt;code&amp;gt;queue&amp;lt;/code&amp;gt; and ''mo'', and ''mo'' as the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-callback-this-value callback this value]&amp;lt;/span&amp;gt;.&lt;br /&gt;
        If this throws an exception, then we will report the exception.&lt;br /&gt;
  6) For each ''&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-slot slot]&amp;lt;/span&amp;gt;'' in ''signalList'', an event named ''slotchange'' will be fired in the same order as it is stored in the &amp;lt;code&amp;gt;signalist&amp;lt;/code&amp;gt;,&lt;br /&gt;
      with its ''&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-event-bubbles bubbles]&amp;lt;/span&amp;gt;'' attribute set to ''true'', at ''slot''.&lt;br /&gt;
&lt;br /&gt;
===Add support for observing specific mutations===&lt;br /&gt;
*Firstly we will add a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects to &amp;lt;code&amp;gt;Node&amp;lt;/code&amp;gt; to store the Mutation Observers.&lt;br /&gt;
*Then we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationobserver-observe observe]&amp;lt;/span&amp;gt; method of MutationObserver. As per the DOM specification, the observe method has the following behaviour:&lt;br /&gt;
  1) If either ''options''’ ''attributeOldValue'' or ''attributeFilter'' is present and ''options''’ ''attributes'' is omitted, then we set the ''options''’ ''attributes''&lt;br /&gt;
    to true.&lt;br /&gt;
  2) If options’ ''characterDataOldValue'' is present and options’ ''characterData'' is omitted, then we set options’ ''characterData'' to true.&lt;br /&gt;
  3) If none of options’ ''childList'', attributes, and ''characterData'' is true, then we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-throw throw]&amp;lt;/span&amp;gt; a ''TypeError''.&lt;br /&gt;
  4) If options’ ''attributeOldValue'' is true and options’ ''attributes'' is false, then we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-throw throw]&amp;lt;/span&amp;gt; a ''TypeError''.&lt;br /&gt;
  5) If options’ ''attributeFilter'' is present and options’ ''attributes'' is false, then we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-throw throw]&amp;lt;/span&amp;gt; a ''TypeError''.&lt;br /&gt;
  6) If options’ ''characterDataOldValue'' is true and options’ ''characterData'' is false, then we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-throw throw]&amp;lt;/span&amp;gt; a ''TypeError''.&lt;br /&gt;
  7) For each &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; &amp;quot;''registered''&amp;quot; in target’s list of &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; whose '''observer''' is the context object we perform the&lt;br /&gt;
    following steps:&lt;br /&gt;
    1) We remove all &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#transient-registered-observer transient registered observers]&amp;lt;/span&amp;gt; whose '''source''' is &amp;quot;''registered''&amp;quot;.&lt;br /&gt;
    2) We also replace ''registered''’s '''options''' with options. &lt;br /&gt;
  8) Otherwise, we add a new &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; to target’s list of &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; with the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#context-object context object]&amp;lt;/span&amp;gt; as the observer and ''options''&lt;br /&gt;
    as the options, and then also, we add target to &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#context-object context object]&amp;lt;/span&amp;gt;’s list of &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-node node]&amp;lt;/span&amp;gt; on which it is registered. &lt;br /&gt;
'''Note''': Steps 7 and 8 in the above description means that we replace an existing matching entry with the new options, or add a new entry if there is no match.&lt;br /&gt;
&lt;br /&gt;
*Next, we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record algorithm]&amp;lt;/span&amp;gt;. Which is described as follows:&lt;br /&gt;
  1) Declare the ''interested'' observers initially as an empty set of &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutationobserver MutationObserver]&amp;lt;/span&amp;gt; objects optionally paired with a string.&lt;br /&gt;
  2) Declare ''nodes'' be the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor inclusive ancestors]&amp;lt;/span&amp;gt; of target.&lt;br /&gt;
  3) For each ''node'' in nodes, and then for each ''registered observer'' (with ''registered observer''’s '''options''' as ''options'') in node’s list of&lt;br /&gt;
    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; we decide:&lt;br /&gt;
    1) If none of the following are true&lt;br /&gt;
      * ''node'' is not target and ''options''’ subtree is false&lt;br /&gt;
      * ''type'' is &amp;quot;''attributes''&amp;quot; and ''options''’ ''attributes'' is not true&lt;br /&gt;
      * ''type'' is &amp;quot;''attributes''&amp;quot;, ''options''’ ''attributeFilter'' is present, and ''options''’ ''attributeFilter'' does not contain name or namespace is non-null&lt;br /&gt;
      * ''type'' is &amp;quot;''characterData''&amp;quot; and ''options''’ ''characterData'' is not true&lt;br /&gt;
      * ''type'' is &amp;quot;''childList''&amp;quot; and ''options''’ ''childList'' is false &lt;br /&gt;
    then,:&lt;br /&gt;
      1) If ''registered observer''’s '''observer''' is not in ''interested'' observers, we append ''registered observer''’s '''observer''' to ''interested observers''.&lt;br /&gt;
      2) If either type is &amp;quot;''attributes''&amp;quot; and ''options''’ ''attributeOldValue'' is true, or type is &amp;quot;''characterData''&amp;quot; and ''options''’ &lt;br /&gt;
        ''characterDataOldValue'' is true,we set the paired string of ''registered observer''’s '''observer''' in ''interested observers'' to ''oldValue''.&lt;br /&gt;
  4) For each ''observer'' in ''interested observers'':&lt;br /&gt;
    1) Declare ''record'' to be a new &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutationrecord MutationRecord]&amp;lt;/span&amp;gt; object with its &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-type type]&amp;lt;/span&amp;gt; set to ''type'' and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-target target]&amp;lt;/span&amp;gt; set to ''target''.&lt;br /&gt;
    2) If ''name'' and ''namespace'' are given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-attributename attributeName]&amp;lt;/span&amp;gt; to ''name'', and ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-attributenamespace attributeNamespace]&amp;lt;/span&amp;gt; to ''namespace''.&lt;br /&gt;
    3) If ''addedNodes'' is given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-addednodes addedNodes]&amp;lt;/span&amp;gt; to ''addedNodes''.&lt;br /&gt;
    4) If ''removedNodes'' is given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-removednodes removedNodes]&amp;lt;/span&amp;gt; to ''removedNodes'',&lt;br /&gt;
    5) If ''previousSibling'' is given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-previoussibling previousSibling]&amp;lt;/span&amp;gt; to ''previousSibling''.&lt;br /&gt;
    6) If ''nextSibling'' is given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-nextsibling nextSibling]&amp;lt;/span&amp;gt; to ''nextSibling''.&lt;br /&gt;
    7) If ''observer'' has a paired string, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-oldvalue oldValue]&amp;lt;/span&amp;gt; to ''observer''’s paired string.&lt;br /&gt;
    8) Then, append ''record'' to ''observer''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-mo-queue record queue]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  5) &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask Queue a mutation observer compound microtask]&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
*We will make &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-change changing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing]&amp;lt;/span&amp;gt; of an attribute, queue a mutation record via the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value]&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute]&amp;lt;/span&amp;gt;, and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&amp;lt;/span&amp;gt; attributes. These changes are performed in the following steps:&lt;br /&gt;
**If we want to '''change''' an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute attribute]&amp;lt;/span&amp;gt; ''attribute'' from an element ''element'' to value, we run these steps:&lt;br /&gt;
  * Queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue attribute’s value.&lt;br /&gt;
  * If element is custom, we enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, attribute’s value, value, and attribute’s namespace.&lt;br /&gt;
  * We then run the attribute change steps with element, attribute’s local name, attribute’s value, value, and attribute’s namespace.&lt;br /&gt;
  * We set attribute’s value to value.&lt;br /&gt;
**If we want to '''append''' an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute attribute]&amp;lt;/span&amp;gt; ''attribute'' to an element ''element'', we run these steps:&lt;br /&gt;
  * We queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue null.&lt;br /&gt;
  * If element is custom, we enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, null, attribute’s value, and attribute’s namespace.&lt;br /&gt;
  * We then run the attribute change steps with element, attribute’s local name, null, attribute’s value, and attribute’s namespace.&lt;br /&gt;
  * We also append attribute to element’s attribute list.&lt;br /&gt;
  * We then set attribute’s element to element. &lt;br /&gt;
**If we want to '''remove''' an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute attribute]&amp;lt;/span&amp;gt; ''attribute'' from an element ''element'', we run these steps:&lt;br /&gt;
  * We queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue attribute’s value.&lt;br /&gt;
  * If element is custom, we then enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, attribute’s value, null, and attribute’s namespace.&lt;br /&gt;
  * We run the attribute change steps with element, attribute’s local name, attribute’s value, null, and attribute’s namespace.&lt;br /&gt;
  * We then remove attribute from element’s attribute list.&lt;br /&gt;
  * We set attribute’s element to null. &lt;br /&gt;
**If we want to '''replace''' an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute attribute]&amp;lt;/span&amp;gt; ''oldAttr'' by an &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-attribute attribute]&amp;lt;/span&amp;gt; ''newAttr'' in an element ''element'', run these steps:&lt;br /&gt;
  * We queue a mutation record of &amp;quot;attributes&amp;quot; for element with name oldAttr’s local name, namespace oldAttr’s namespace, and oldValue oldAttr’s value.&lt;br /&gt;
  * If element is custom, we then enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing oldAttr’s local name, oldAttr’s value, newAttr’s value, and oldAttr’s namespace.&lt;br /&gt;
  * We run the attribute change steps with element, oldAttr’s local name, oldAttr’s value, newAttr’s value, and oldAttr’s namespace.&lt;br /&gt;
  * We then replace oldAttr by newAttr in element’s attribute list.&lt;br /&gt;
  * We set oldAttr’s element to null.&lt;br /&gt;
  * We set newAttr’s element to element.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;,, our tests were written with regard to attributes, Childlist, Character data and records of a Mutation Observer. These tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
For this part of the project, our test plan is to check the following:&lt;br /&gt;
*Test the micro task for mutation observer.&lt;br /&gt;
**Check if microtask queued flag is initially unset.&lt;br /&gt;
**Check if the task returns on setting the microtask queued flag.&lt;br /&gt;
**On notifying mutation observers, check if microtask queued flag is unset.&lt;br /&gt;
**Check the size of record queue on notifying mutation observers.&lt;br /&gt;
**Check if the number of events fired is equal to number of slots in Signal list.&lt;br /&gt;
&lt;br /&gt;
*Test the observation of specific mutations:&lt;br /&gt;
**Whenever an observe method is invoked and attributeOldValue or attributeFilter is present and attributes is omitted, check if attributes is set to true.&lt;br /&gt;
**Whenever an observe method is invoked and characterDataOldValue is present and characterData is omitted, check if characterData is set to true.&lt;br /&gt;
**Whenever an observe method is invoked and a TypeError is thrown, check if atleast one of the following scenarios are true.&lt;br /&gt;
***If none of options’ childList, attributes, and characterData is true.&lt;br /&gt;
***attributeOldValue is true and attributes is false.&lt;br /&gt;
***attributeFilter is present and attributes is false.&lt;br /&gt;
***characterDataOldValue is true and characterData is false.&lt;br /&gt;
&lt;br /&gt;
The web-platform tests can be run by giving the following command at the root directory of the project:&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
We have Updated the corresponding test expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in the &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
Our Project follows the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern]&amp;lt;/span&amp;gt;, where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108132</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108132"/>
		<updated>2017-04-08T00:16:01Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Add support for observing specific mutations */ Updated section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Document_Object_Model DOM]&amp;lt;/span&amp;gt; standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up and Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/srivassumit/servo/wiki/Readme read me]&amp;lt;/span&amp;gt; page of the project's Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
The purpose of this project is to implement the basic functionality required to implement a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutation-observers Mutation Observer API]&amp;lt;/span&amp;gt; as defined in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org DOM]&amp;lt;/span&amp;gt; Specifications.&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;, we implemented the initial Steps as described in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/wiki/Mutation-observer-project Project Specification]&amp;lt;/span&amp;gt;. The initial implementation is merged in the original Servo Repository and the code can be found &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/commit/107ac9ab56c1a4cee3e5f9828f91ab394e3e8eee here]&amp;lt;/span&amp;gt;.&lt;br /&gt;
For the next phase of the project, we have to implement the functionality for supporting Mutation Observers.&lt;br /&gt;
Based on the Project description, we have made a Project Design, which is described in detail below.&lt;br /&gt;
&lt;br /&gt;
=='''Project Design'''==&lt;br /&gt;
&lt;br /&gt;
===Add support for mutation observer microtasks===&lt;br /&gt;
&lt;br /&gt;
*We will add a &amp;lt;code&amp;gt;mutation_observer_compound_microtask_queued&amp;lt;/code&amp;gt; member to the &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt; class. This will be used later to implement the algorithm for ''queuing a mutation observer compound microtask'' and ''notifying a mutation observer'' as described below.&lt;br /&gt;
&lt;br /&gt;
*Then, we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]&amp;lt;/span&amp;gt; by adding a new variant to the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask]&amp;lt;/span&amp;gt; enum for mutation observers. The algorithm for doing that is described below:&lt;br /&gt;
  1) If the ''mutation observer compound microtask queued'' flag is set, then return.&lt;br /&gt;
  2) Set the ''mutation observer compound microtask queued'' flag.&lt;br /&gt;
  3) &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-microtask Queue]&amp;lt;/span&amp;gt; a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/webappapis.html#compound-microtask compound microtask]&amp;lt;/span&amp;gt; which will be used to notify the mutation observers.&lt;br /&gt;
&lt;br /&gt;
*Next, we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers algorithm]&amp;lt;/span&amp;gt; using the vector of observers previously added to the &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt; class. The notify mutation observers algorithm is implemented as described below:&lt;br /&gt;
  1) Unset the ''mutation observer compound microtask queued'' flag, which was set in the previous algorithm.&lt;br /&gt;
  2) Declare ''notifyList'' to be a copy of ''unit of related similar-origin browsing contexts''' list of MutationObserver objects.&lt;br /&gt;
  3) Declare ''signalList'' to be a copy of ''unit of related similar-origin browsing contexts''' &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#signal-slot-list signal slot list]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  4) Empty the ''unit of related similar-origin browsing contexts''' signal slot list.&lt;br /&gt;
  5) For each MutationObserver object ''mo'' in ''notifyList'', we shall execute a ''compound microtask subtask'' to run these steps:&lt;br /&gt;
    1) Declare ''queue'' to contain ''mo'''s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-mo-queue record queue]&amp;lt;/span&amp;gt;.&lt;br /&gt;
    2) Empty ''mo'''s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-mo-queue record queue]&amp;lt;/span&amp;gt;.&lt;br /&gt;
    3) All transient registered observers whose observer is ''mo'' will be removed.&lt;br /&gt;
    4) If ''queue'' is non-empty, then invoke ''mo''’s callback with a list of arguments consisting of &amp;lt;code&amp;gt;queue&amp;lt;/code&amp;gt; and ''mo'', and ''mo'' as the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-callback-this-value callback this value]&amp;lt;/span&amp;gt;.&lt;br /&gt;
        If this throws an exception, then we will report the exception.&lt;br /&gt;
  6) For each ''&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-slot slot]&amp;lt;/span&amp;gt;'' in ''signalList'', an event named ''slotchange'' will be fired in the same order as it is stored in the &amp;lt;code&amp;gt;signalist&amp;lt;/code&amp;gt;,&lt;br /&gt;
      with its ''&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-event-bubbles bubbles]&amp;lt;/span&amp;gt;'' attribute set to ''true'', at ''slot''.&lt;br /&gt;
&lt;br /&gt;
===Add support for observing specific mutations===&lt;br /&gt;
*Firstly we will add a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects to &amp;lt;code&amp;gt;Node&amp;lt;/code&amp;gt; to store the Mutation Observers.&lt;br /&gt;
*Then we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationobserver-observe observe]&amp;lt;/span&amp;gt; method of MutationObserver. As per the DOM specification, the observe method has the following behaviour:&lt;br /&gt;
  1) If either ''options''’ ''attributeOldValue'' or ''attributeFilter'' is present and ''options''’ ''attributes'' is omitted, then we set the ''options''’ ''attributes''&lt;br /&gt;
    to true.&lt;br /&gt;
  2) If options’ ''characterDataOldValue'' is present and options’ ''characterData'' is omitted, then we set options’ ''characterData'' to true.&lt;br /&gt;
  3) If none of options’ ''childList'', attributes, and ''characterData'' is true, then we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-throw throw]&amp;lt;/span&amp;gt; a ''TypeError''.&lt;br /&gt;
  4) If options’ ''attributeOldValue'' is true and options’ ''attributes'' is false, then we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-throw throw]&amp;lt;/span&amp;gt; a ''TypeError''.&lt;br /&gt;
  5) If options’ ''attributeFilter'' is present and options’ ''attributes'' is false, then we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-throw throw]&amp;lt;/span&amp;gt; a ''TypeError''.&lt;br /&gt;
  6) If options’ ''characterDataOldValue'' is true and options’ ''characterData'' is false, then we &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-throw throw]&amp;lt;/span&amp;gt; a ''TypeError''.&lt;br /&gt;
  7) For each &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; &amp;quot;''registered''&amp;quot; in target’s list of &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; whose '''observer''' is the context object we perform the&lt;br /&gt;
    following steps:&lt;br /&gt;
    1) We remove all &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#transient-registered-observer transient registered observers]&amp;lt;/span&amp;gt; whose '''source''' is &amp;quot;''registered''&amp;quot;.&lt;br /&gt;
    2) We also replace ''registered''’s '''options''' with options. &lt;br /&gt;
  8) Otherwise, we add a new &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; to target’s list of &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; with the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#context-object context object]&amp;lt;/span&amp;gt; as the observer and ''options''&lt;br /&gt;
    as the options, and then also, we add target to &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#context-object context object]&amp;lt;/span&amp;gt;’s list of &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-node node]&amp;lt;/span&amp;gt; on which it is registered. &lt;br /&gt;
'''Note''': Steps 7 and 8 in the above description means that we replace an existing matching entry with the new options, or add a new entry if there is no match.&lt;br /&gt;
&lt;br /&gt;
*Next, we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record algorithm]&amp;lt;/span&amp;gt;. Which is described as follows:&lt;br /&gt;
  1) Declare the ''interested'' observers initially as an empty set of &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutationobserver MutationObserver]&amp;lt;/span&amp;gt; objects optionally paired with a string.&lt;br /&gt;
  2) Declare ''nodes'' be the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor inclusive ancestors]&amp;lt;/span&amp;gt; of target.&lt;br /&gt;
  3) For each ''node'' in nodes, and then for each ''registered observer'' (with ''registered observer''’s '''options''' as ''options'') in node’s list of&lt;br /&gt;
    &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#registered-observer registered observers]&amp;lt;/span&amp;gt; we decide:&lt;br /&gt;
    1) If none of the following are true&lt;br /&gt;
      * ''node'' is not target and ''options''’ subtree is false&lt;br /&gt;
      * ''type'' is &amp;quot;''attributes''&amp;quot; and ''options''’ ''attributes'' is not true&lt;br /&gt;
      * ''type'' is &amp;quot;''attributes''&amp;quot;, ''options''’ ''attributeFilter'' is present, and ''options''’ ''attributeFilter'' does not contain name or namespace is non-null&lt;br /&gt;
      * ''type'' is &amp;quot;''characterData''&amp;quot; and ''options''’ ''characterData'' is not true&lt;br /&gt;
      * ''type'' is &amp;quot;''childList''&amp;quot; and ''options''’ ''childList'' is false &lt;br /&gt;
    then,:&lt;br /&gt;
      1) If ''registered observer''’s '''observer''' is not in ''interested'' observers, we append ''registered observer''’s '''observer''' to ''interested observers''.&lt;br /&gt;
      2) If either type is &amp;quot;''attributes''&amp;quot; and ''options''’ ''attributeOldValue'' is true, or type is &amp;quot;''characterData''&amp;quot; and ''options''’ &lt;br /&gt;
        ''characterDataOldValue'' is true,we set the paired string of ''registered observer''’s '''observer''' in ''interested observers'' to ''oldValue''.&lt;br /&gt;
  4) For each ''observer'' in ''interested observers'':&lt;br /&gt;
    1) Declare ''record'' to be a new &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutationrecord MutationRecord]&amp;lt;/span&amp;gt; object with its &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-type type]&amp;lt;/span&amp;gt; set to ''type'' and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-target target]&amp;lt;/span&amp;gt; set to ''target''.&lt;br /&gt;
    2) If ''name'' and ''namespace'' are given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-attributename attributeName]&amp;lt;/span&amp;gt; to ''name'', and ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-attributenamespace attributeNamespace]&amp;lt;/span&amp;gt; to ''namespace''.&lt;br /&gt;
    3) If ''addedNodes'' is given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-addednodes addedNodes]&amp;lt;/span&amp;gt; to ''addedNodes''.&lt;br /&gt;
    4) If ''removedNodes'' is given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-removednodes removedNodes]&amp;lt;/span&amp;gt; to ''removedNodes'',&lt;br /&gt;
    5) If ''previousSibling'' is given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-previoussibling previousSibling]&amp;lt;/span&amp;gt; to ''previousSibling''.&lt;br /&gt;
    6) If ''nextSibling'' is given, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-nextsibling nextSibling]&amp;lt;/span&amp;gt; to ''nextSibling''.&lt;br /&gt;
    7) If ''observer'' has a paired string, we set ''record''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationrecord-oldvalue oldValue]&amp;lt;/span&amp;gt; to ''observer''’s paired string.&lt;br /&gt;
    8) Then, append ''record'' to ''observer''’s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-mo-queue record queue]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  5) &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask Queue a mutation observer compound microtask]&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
*We will make &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-change changing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing]&amp;lt;/span&amp;gt; an attribute queue a mutation record via &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value]&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute]&amp;lt;/span&amp;gt;, and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&amp;lt;/span&amp;gt;.&lt;br /&gt;
**In order to perform the following tasks, we will follow the steps given after them.&lt;br /&gt;
**If we want to change an attribute attribute from an element element to value, we run these steps:&lt;br /&gt;
***We first queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue attribute’s value.&lt;br /&gt;
***If element is custom, we enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, attribute’s value, value, and attribute’s namespace.&lt;br /&gt;
***We then run the attribute change steps with element, attribute’s local name, attribute’s value, value, and attribute’s namespace.&lt;br /&gt;
***We set attribute’s value to value. &lt;br /&gt;
**If we want to append an attribute attribute to an element element, we run these steps:&lt;br /&gt;
***We queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue null.&lt;br /&gt;
***If element is custom, we enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, null, attribute’s value, and attribute’s namespace.&lt;br /&gt;
***We then run the attribute change steps with element, attribute’s local name, null, attribute’s value, and attribute’s namespace.&lt;br /&gt;
***We also append attribute to element’s attribute list.&lt;br /&gt;
***We then set attribute’s element to element. &lt;br /&gt;
**If we want to remove an attribute attribute from an element element, we run these steps:&lt;br /&gt;
***We queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue attribute’s value.&lt;br /&gt;
***If element is custom, we then enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, attribute’s value, null, and attribute’s namespace.&lt;br /&gt;
***We run the attribute change steps with element, attribute’s local name, attribute’s value, null, and attribute’s namespace.&lt;br /&gt;
***We then remove attribute from element’s attribute list.&lt;br /&gt;
***We set attribute’s element to null. &lt;br /&gt;
**If we want to replace an attribute oldAttr by an attribute newAttr in an element element, run these steps:&lt;br /&gt;
***We first queue a mutation record of &amp;quot;attributes&amp;quot; for element with name oldAttr’s local name, namespace oldAttr’s namespace, and oldValue oldAttr’s value.&lt;br /&gt;
***If element is custom, we then enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing oldAttr’s local name, oldAttr’s value, newAttr’s value, and oldAttr’s namespace.&lt;br /&gt;
***We run the attribute change steps with element, oldAttr’s local name, oldAttr’s value, newAttr’s value, and oldAttr’s namespace.&lt;br /&gt;
***We then replace oldAttr by newAttr in element’s attribute list.&lt;br /&gt;
***We set oldAttr’s element to null.&lt;br /&gt;
***We set newAttr’s element to element.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;,, our tests were written with regard to attributes, Childlist, Character data and records of a Mutation Observer. These tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
For this part of the project, our test plan is to check the following:&lt;br /&gt;
*Test the micro task for mutation observer.&lt;br /&gt;
**Check if microtask queued flag is initially unset.&lt;br /&gt;
**Check if the task returns on setting the microtask queued flag.&lt;br /&gt;
**On notifying mutation observers, check if microtask queued flag is unset.&lt;br /&gt;
**Check the size of record queue on notifying mutation observers.&lt;br /&gt;
**Check if the number of events fired is equal to number of slots in Signal list.&lt;br /&gt;
&lt;br /&gt;
*Test the observation of specific mutations:&lt;br /&gt;
**Whenever an observe method is invoked and attributeOldValue or attributeFilter is present and attributes is omitted, check if attributes is set to true.&lt;br /&gt;
**Whenever an observe method is invoked and characterDataOldValue is present and characterData is omitted, check if characterData is set to true.&lt;br /&gt;
**Whenever an observe method is invoked and a TypeError is thrown, check if atleast one of the following scenarios are true.&lt;br /&gt;
***If none of options’ childList, attributes, and characterData is true.&lt;br /&gt;
***attributeOldValue is true and attributes is false.&lt;br /&gt;
***attributeFilter is present and attributes is false.&lt;br /&gt;
***characterDataOldValue is true and characterData is false.&lt;br /&gt;
&lt;br /&gt;
The web-platform tests can be run by giving the following command at the root directory of the project:&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
We have Updated the corresponding test expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in the &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
Our Project follows the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern]&amp;lt;/span&amp;gt;, where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108129</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108129"/>
		<updated>2017-04-07T23:27:39Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Add support for mutation observer microtasks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Document_Object_Model DOM]&amp;lt;/span&amp;gt; standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up and Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/srivassumit/servo/wiki/Readme read me]&amp;lt;/span&amp;gt; page of the project's Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
The purpose of this project is to implement the basic functionality required to implement a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutation-observers Mutation Observer API]&amp;lt;/span&amp;gt; as defined in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org DOM]&amp;lt;/span&amp;gt; Specifications.&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;, we implemented the initial Steps as described in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/wiki/Mutation-observer-project Project Specification]&amp;lt;/span&amp;gt;. The initial implementation is merged in the original Servo Repository and the code can be found &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/commit/107ac9ab56c1a4cee3e5f9828f91ab394e3e8eee here]&amp;lt;/span&amp;gt;.&lt;br /&gt;
For the next phase of the project, we have to implement the functionality for supporting Mutation Observers.&lt;br /&gt;
Based on the Project description, we have made a Project Design, which is described in detail below.&lt;br /&gt;
&lt;br /&gt;
=='''Project Design'''==&lt;br /&gt;
&lt;br /&gt;
===Add support for mutation observer microtasks===&lt;br /&gt;
&lt;br /&gt;
*We will add a &amp;lt;code&amp;gt;mutation_observer_compound_microtask_queued&amp;lt;/code&amp;gt; member to the &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt; class. This will be used later to implement the algorithm for ''queuing a mutation observer compound microtask'' and ''notifying a mutation observer'' as described below.&lt;br /&gt;
&lt;br /&gt;
*Then, we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]&amp;lt;/span&amp;gt; by adding a new variant to the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask]&amp;lt;/span&amp;gt; enum for mutation observers. The algorithm for doing that is described below:&lt;br /&gt;
  1) If the ''mutation observer compound microtask queued'' flag is set, then return.&lt;br /&gt;
  2) Set the ''mutation observer compound microtask queued'' flag.&lt;br /&gt;
  3) &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-microtask Queue]&amp;lt;/span&amp;gt; a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/webappapis.html#compound-microtask compound microtask]&amp;lt;/span&amp;gt; which will be used to notify the mutation observers.&lt;br /&gt;
&lt;br /&gt;
*Next, we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers algorithm]&amp;lt;/span&amp;gt; using the vector of observers previously added to the &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt; class. The notify mutation observers algorithm is implemented as described below:&lt;br /&gt;
  1) Unset the ''mutation observer compound microtask queued'' flag, which was set in the previous algorithm.&lt;br /&gt;
  2) Declare ''notifyList'' to be a copy of ''unit of related similar-origin browsing contexts''' list of MutationObserver objects.&lt;br /&gt;
  3) Declare ''signalList'' to be a copy of ''unit of related similar-origin browsing contexts''' &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#signal-slot-list signal slot list]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  4) Empty the ''unit of related similar-origin browsing contexts''' signal slot list.&lt;br /&gt;
  5) For each MutationObserver object ''mo'' in ''notifyList'', we shall execute a ''compound microtask subtask'' to run these steps:&lt;br /&gt;
    1) Declare ''queue'' to contain ''mo'''s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-mo-queue record queue]&amp;lt;/span&amp;gt;.&lt;br /&gt;
    2) Empty ''mo'''s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-mo-queue record queue]&amp;lt;/span&amp;gt;.&lt;br /&gt;
    3) All transient registered observers whose observer is ''mo'' will be removed.&lt;br /&gt;
    4) If ''queue'' is non-empty, then invoke ''mo''’s callback with a list of arguments consisting of &amp;lt;code&amp;gt;queue&amp;lt;/code&amp;gt; and ''mo'', and ''mo'' as the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-callback-this-value callback this value]&amp;lt;/span&amp;gt;.&lt;br /&gt;
        If this throws an exception, then we will report the exception.&lt;br /&gt;
  6) For each ''&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-slot slot]&amp;lt;/span&amp;gt;'' in ''signalList'', an event named ''slotchange'' will be fired in the same order as it is stored in the &amp;lt;code&amp;gt;signalist&amp;lt;/code&amp;gt;,&lt;br /&gt;
      with its ''&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-event-bubbles bubbles]&amp;lt;/span&amp;gt;'' attribute set to ''true'', at ''slot''.&lt;br /&gt;
&lt;br /&gt;
===Add support for observing specific mutations===&lt;br /&gt;
*Firstly we will add a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects to &amp;lt;code&amp;gt;Node&amp;lt;/code&amp;gt;.&lt;br /&gt;
*Then we will implement &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationobserver-observe observe]&amp;lt;/span&amp;gt; method of MutationObserver. As per the DOM specification, the observe method has the following behaviour:&lt;br /&gt;
**If either ''options''’ &amp;lt;code&amp;gt;attributeOldValue&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;attributeFilter&amp;lt;/code&amp;gt; is present and ''options''’ &amp;lt;code&amp;gt;attributes&amp;lt;/code&amp;gt; is omitted, then we set the ''options''’ attributes to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;.&lt;br /&gt;
**If options’ characterDataOldValue is present and options’ characterData is omitted, then we set options’ characterData to true.&lt;br /&gt;
**If none of options’ childList, attributes, and characterData is true, then we throw a TypeError.&lt;br /&gt;
**If options’ attributeOldValue is true and options’ attributes is false, then we throw a TypeError.&lt;br /&gt;
**If options’ attributeFilter is present and options’ attributes is false, then we throw a TypeError.&lt;br /&gt;
**If options’ characterDataOldValue is true and options’ characterData is false, then we throw a TypeError.&lt;br /&gt;
**For each observer registered in target’s list of registered observers whose observer is the context object we perform the following steps:&lt;br /&gt;
***We remove all transient registered observers whose source is registered.&lt;br /&gt;
***We also replace registered’s options with options. &lt;br /&gt;
**Otherwise, we add a new registered observer to target’s list of registered observers with the context object as the observer and options as the options, and then also, we add target to context object’s list of nodes on which it is registered. &lt;br /&gt;
**The last two steps above mean we replace an existing matching entry with the new options, or add a new entry if there is no match.&lt;br /&gt;
*We will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record algorithm]&amp;lt;/span&amp;gt;. The queue a mutation record algorithm has the following behavior:&lt;br /&gt;
**We declare the interested observers initially as an empty set of MutationObserver objects optionally paired with a string.&lt;br /&gt;
**We also declare nodes be the inclusive ancestors of target.&lt;br /&gt;
**For each node in nodes, and then for each registered observer (with registered observer’s options as options) in node’s list of registered observers we decide:&lt;br /&gt;
***If none of the following are true&lt;br /&gt;
****node is not target and options’ subtree is false&lt;br /&gt;
****type is &amp;quot;attributes&amp;quot; and options’ attributes is not true&lt;br /&gt;
****type is &amp;quot;attributes&amp;quot;, options’ attributeFilter is present, and options’ attributeFilter does not contain name or namespace is non-null&lt;br /&gt;
****type is &amp;quot;characterData&amp;quot; and options’ characterData is not true&lt;br /&gt;
****type is &amp;quot;childList&amp;quot; and options’ childList is false &lt;br /&gt;
***then,:&lt;br /&gt;
****If registered observer’s observer is not in interested observers, we append registered observer’s observer to interested observers.&lt;br /&gt;
****If either type is &amp;quot;attributes&amp;quot; and options’ attributeOldValue is true, or type is &amp;quot;characterData&amp;quot; and options’ characterDataOldValue is true,we set the paired string of registered observer’s observer in interested observers to oldValue.&lt;br /&gt;
**For each observer in interested observers:&lt;br /&gt;
***We declare record to be a new MutationRecord object with its type set to type and target set to target.&lt;br /&gt;
***If name and namespace are given, we set record’s attributeName to name, and record’s attributeNamespace to namespace.&lt;br /&gt;
***If addedNodes is given, we set record’s addedNodes to addedNodes.&lt;br /&gt;
***If removedNodes is given, we set record’s removedNodes to removedNodes,&lt;br /&gt;
***If previousSibling is given, we set record’s previousSibling to previousSibling.&lt;br /&gt;
***If nextSibling is given, we set record’s nextSibling to nextSibling.&lt;br /&gt;
***If observer has a paired string, we set record’s oldValue to observer’s paired string.&lt;br /&gt;
***We then append record to observer’s record queue. &lt;br /&gt;
**We then queue a mutation observer compound microtask. &lt;br /&gt;
*We will make &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-change changing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing]&amp;lt;/span&amp;gt; an attribute queue a mutation record via &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value]&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute]&amp;lt;/span&amp;gt;, and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&amp;lt;/span&amp;gt;.&lt;br /&gt;
**In order to perform the following tasks, we will follow the steps given after them.&lt;br /&gt;
**If we want to change an attribute attribute from an element element to value, we run these steps:&lt;br /&gt;
***We first queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue attribute’s value.&lt;br /&gt;
***If element is custom, we enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, attribute’s value, value, and attribute’s namespace.&lt;br /&gt;
***We then run the attribute change steps with element, attribute’s local name, attribute’s value, value, and attribute’s namespace.&lt;br /&gt;
***We set attribute’s value to value. &lt;br /&gt;
**If we want to append an attribute attribute to an element element, we run these steps:&lt;br /&gt;
***We queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue null.&lt;br /&gt;
***If element is custom, we enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, null, attribute’s value, and attribute’s namespace.&lt;br /&gt;
***We then run the attribute change steps with element, attribute’s local name, null, attribute’s value, and attribute’s namespace.&lt;br /&gt;
***We also append attribute to element’s attribute list.&lt;br /&gt;
***We then set attribute’s element to element. &lt;br /&gt;
**If we want to remove an attribute attribute from an element element, we run these steps:&lt;br /&gt;
***We queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue attribute’s value.&lt;br /&gt;
***If element is custom, we then enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, attribute’s value, null, and attribute’s namespace.&lt;br /&gt;
***We run the attribute change steps with element, attribute’s local name, attribute’s value, null, and attribute’s namespace.&lt;br /&gt;
***We then remove attribute from element’s attribute list.&lt;br /&gt;
***We set attribute’s element to null. &lt;br /&gt;
**If we want to replace an attribute oldAttr by an attribute newAttr in an element element, run these steps:&lt;br /&gt;
***We first queue a mutation record of &amp;quot;attributes&amp;quot; for element with name oldAttr’s local name, namespace oldAttr’s namespace, and oldValue oldAttr’s value.&lt;br /&gt;
***If element is custom, we then enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing oldAttr’s local name, oldAttr’s value, newAttr’s value, and oldAttr’s namespace.&lt;br /&gt;
***We run the attribute change steps with element, oldAttr’s local name, oldAttr’s value, newAttr’s value, and oldAttr’s namespace.&lt;br /&gt;
***We then replace oldAttr by newAttr in element’s attribute list.&lt;br /&gt;
***We set oldAttr’s element to null.&lt;br /&gt;
***We set newAttr’s element to element.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;,, our tests were written with regard to attributes, Childlist, Character data and records of a Mutation Observer. These tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
For this part of the project, our test plan is to check the following:&lt;br /&gt;
*Test the micro task for mutation observer.&lt;br /&gt;
**Check if microtask queued flag is initially unset.&lt;br /&gt;
**Check if the task returns on setting the microtask queued flag.&lt;br /&gt;
**On notifying mutation observers, check if microtask queued flag is unset.&lt;br /&gt;
**Check the size of record queue on notifying mutation observers.&lt;br /&gt;
**Check if the number of events fired is equal to number of slots in Signal list.&lt;br /&gt;
&lt;br /&gt;
*Test the observation of specific mutations:&lt;br /&gt;
**Whenever an observe method is invoked and attributeOldValue or attributeFilter is present and attributes is omitted, check if attributes is set to true.&lt;br /&gt;
**Whenever an observe method is invoked and characterDataOldValue is present and characterData is omitted, check if characterData is set to true.&lt;br /&gt;
**Whenever an observe method is invoked and a TypeError is thrown, check if atleast one of the following scenarios are true.&lt;br /&gt;
***If none of options’ childList, attributes, and characterData is true.&lt;br /&gt;
***attributeOldValue is true and attributes is false.&lt;br /&gt;
***attributeFilter is present and attributes is false.&lt;br /&gt;
***characterDataOldValue is true and characterData is false.&lt;br /&gt;
&lt;br /&gt;
The web-platform tests can be run by giving the following command at the root directory of the project:&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
We have Updated the corresponding test expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in the &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
Our Project follows the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern]&amp;lt;/span&amp;gt;, where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108128</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108128"/>
		<updated>2017-04-07T23:25:00Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Project Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Document_Object_Model DOM]&amp;lt;/span&amp;gt; standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up and Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/srivassumit/servo/wiki/Readme read me]&amp;lt;/span&amp;gt; page of the project's Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
The purpose of this project is to implement the basic functionality required to implement a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutation-observers Mutation Observer API]&amp;lt;/span&amp;gt; as defined in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org DOM]&amp;lt;/span&amp;gt; Specifications.&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;, we implemented the initial Steps as described in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/wiki/Mutation-observer-project Project Specification]&amp;lt;/span&amp;gt;. The initial implementation is merged in the original Servo Repository and the code can be found &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/commit/107ac9ab56c1a4cee3e5f9828f91ab394e3e8eee here]&amp;lt;/span&amp;gt;.&lt;br /&gt;
For the next phase of the project, we have to implement the functionality for supporting Mutation Observers.&lt;br /&gt;
Based on the Project description, we have made a Project Design, which is described in detail below.&lt;br /&gt;
&lt;br /&gt;
=='''Project Design'''==&lt;br /&gt;
&lt;br /&gt;
===Add support for mutation observer microtasks===&lt;br /&gt;
&lt;br /&gt;
*We will add a &amp;lt;code&amp;gt;mutation_observer_compound_microtask_queued&amp;lt;/code&amp;gt; member to the &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt; class. This will be used later to implement the algorithm for ''queuing a mutation observer compound microtask'' and ''notifying a mutation observer'' as described below.&lt;br /&gt;
&lt;br /&gt;
*Then, we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]&amp;lt;/span&amp;gt; by adding a new variant to the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask]&amp;lt;/span&amp;gt; enum for mutation observers. The algorithm for doing that is described below:&lt;br /&gt;
  1) If the ''mutation observer compound microtask queued'' flag is set, then return.&lt;br /&gt;
  2) Set the ''mutation observer compound microtask queued'' flag.&lt;br /&gt;
  3) &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-microtask Queue]&amp;lt;/span&amp;gt; a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/webappapis.html#compound-microtask compound microtask]&amp;lt;/span&amp;gt; which will be used to notify the mutation observers.&lt;br /&gt;
&lt;br /&gt;
*Next, we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers algorithm]&amp;lt;/span&amp;gt; using the vector of observers previously added to the &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt; class. The notify mutation observers algorithm is implemented as described below:&lt;br /&gt;
  1) Unset the ''mutation observer compound microtask queued'' flag, which was set in the previous algorithm.&lt;br /&gt;
  2) Declare ''notifyList'' to be a copy of ''unit of related similar-origin browsing contexts''' list of MutationObserver objects.&lt;br /&gt;
  3) Declare ''signalList'' to be a copy of ''unit of related similar-origin browsing contexts''' &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#signal-slot-list signal slot list]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  4) Empty the ''unit of related similar-origin browsing contexts''' signal slot list.&lt;br /&gt;
  5) For each MutationObserver object ''mo'' in ''notifyList'', we shall execute a ''compound microtask subtask'' to run these steps:&lt;br /&gt;
    1) Declare ''queue'' to contain ''mo'''s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-mo-queue record queue]&amp;lt;/span&amp;gt;.&lt;br /&gt;
    2) Empty ''mo'''s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-mo-queue record queue]&amp;lt;/span&amp;gt;.&lt;br /&gt;
    3) All transient registered observers whose observer is ''mo'' will be removed.&lt;br /&gt;
    4) If ''queue'' is non-empty, then invoke ''mo''’s callback with a list of arguments consisting of &amp;lt;code&amp;gt;queue&amp;lt;/code&amp;gt; and ''mo'', and ''mo'' as the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://heycam.github.io/webidl/#dfn-callback-this-value callback this value]&amp;lt;/span&amp;gt;.&lt;br /&gt;
      If this throws an exception, then we will report the exception.&lt;br /&gt;
  6) For each ''&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-slot slot]&amp;lt;/span&amp;gt;'' in ''signalList'', an event named ''slotchange'' will be fired in the same order as it is stored in the &amp;lt;code&amp;gt;signalist&amp;lt;/code&amp;gt;,&lt;br /&gt;
    with its ''&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-event-bubbles bubbles]&amp;lt;/span&amp;gt;'' attribute set to ''true'', at ''slot''.&lt;br /&gt;
&lt;br /&gt;
===Add support for observing specific mutations===&lt;br /&gt;
*Firstly we will add a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects to &amp;lt;code&amp;gt;Node&amp;lt;/code&amp;gt;.&lt;br /&gt;
*Then we will implement &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationobserver-observe observe]&amp;lt;/span&amp;gt; method of MutationObserver. As per the DOM specification, the observe method has the following behaviour:&lt;br /&gt;
**If either ''options''’ &amp;lt;code&amp;gt;attributeOldValue&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;attributeFilter&amp;lt;/code&amp;gt; is present and ''options''’ &amp;lt;code&amp;gt;attributes&amp;lt;/code&amp;gt; is omitted, then we set the ''options''’ attributes to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;.&lt;br /&gt;
**If options’ characterDataOldValue is present and options’ characterData is omitted, then we set options’ characterData to true.&lt;br /&gt;
**If none of options’ childList, attributes, and characterData is true, then we throw a TypeError.&lt;br /&gt;
**If options’ attributeOldValue is true and options’ attributes is false, then we throw a TypeError.&lt;br /&gt;
**If options’ attributeFilter is present and options’ attributes is false, then we throw a TypeError.&lt;br /&gt;
**If options’ characterDataOldValue is true and options’ characterData is false, then we throw a TypeError.&lt;br /&gt;
**For each observer registered in target’s list of registered observers whose observer is the context object we perform the following steps:&lt;br /&gt;
***We remove all transient registered observers whose source is registered.&lt;br /&gt;
***We also replace registered’s options with options. &lt;br /&gt;
**Otherwise, we add a new registered observer to target’s list of registered observers with the context object as the observer and options as the options, and then also, we add target to context object’s list of nodes on which it is registered. &lt;br /&gt;
**The last two steps above mean we replace an existing matching entry with the new options, or add a new entry if there is no match.&lt;br /&gt;
*We will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record algorithm]&amp;lt;/span&amp;gt;. The queue a mutation record algorithm has the following behavior:&lt;br /&gt;
**We declare the interested observers initially as an empty set of MutationObserver objects optionally paired with a string.&lt;br /&gt;
**We also declare nodes be the inclusive ancestors of target.&lt;br /&gt;
**For each node in nodes, and then for each registered observer (with registered observer’s options as options) in node’s list of registered observers we decide:&lt;br /&gt;
***If none of the following are true&lt;br /&gt;
****node is not target and options’ subtree is false&lt;br /&gt;
****type is &amp;quot;attributes&amp;quot; and options’ attributes is not true&lt;br /&gt;
****type is &amp;quot;attributes&amp;quot;, options’ attributeFilter is present, and options’ attributeFilter does not contain name or namespace is non-null&lt;br /&gt;
****type is &amp;quot;characterData&amp;quot; and options’ characterData is not true&lt;br /&gt;
****type is &amp;quot;childList&amp;quot; and options’ childList is false &lt;br /&gt;
***then,:&lt;br /&gt;
****If registered observer’s observer is not in interested observers, we append registered observer’s observer to interested observers.&lt;br /&gt;
****If either type is &amp;quot;attributes&amp;quot; and options’ attributeOldValue is true, or type is &amp;quot;characterData&amp;quot; and options’ characterDataOldValue is true,we set the paired string of registered observer’s observer in interested observers to oldValue.&lt;br /&gt;
**For each observer in interested observers:&lt;br /&gt;
***We declare record to be a new MutationRecord object with its type set to type and target set to target.&lt;br /&gt;
***If name and namespace are given, we set record’s attributeName to name, and record’s attributeNamespace to namespace.&lt;br /&gt;
***If addedNodes is given, we set record’s addedNodes to addedNodes.&lt;br /&gt;
***If removedNodes is given, we set record’s removedNodes to removedNodes,&lt;br /&gt;
***If previousSibling is given, we set record’s previousSibling to previousSibling.&lt;br /&gt;
***If nextSibling is given, we set record’s nextSibling to nextSibling.&lt;br /&gt;
***If observer has a paired string, we set record’s oldValue to observer’s paired string.&lt;br /&gt;
***We then append record to observer’s record queue. &lt;br /&gt;
**We then queue a mutation observer compound microtask. &lt;br /&gt;
*We will make &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-change changing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing]&amp;lt;/span&amp;gt; an attribute queue a mutation record via &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value]&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute]&amp;lt;/span&amp;gt;, and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&amp;lt;/span&amp;gt;.&lt;br /&gt;
**In order to perform the following tasks, we will follow the steps given after them.&lt;br /&gt;
**If we want to change an attribute attribute from an element element to value, we run these steps:&lt;br /&gt;
***We first queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue attribute’s value.&lt;br /&gt;
***If element is custom, we enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, attribute’s value, value, and attribute’s namespace.&lt;br /&gt;
***We then run the attribute change steps with element, attribute’s local name, attribute’s value, value, and attribute’s namespace.&lt;br /&gt;
***We set attribute’s value to value. &lt;br /&gt;
**If we want to append an attribute attribute to an element element, we run these steps:&lt;br /&gt;
***We queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue null.&lt;br /&gt;
***If element is custom, we enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, null, attribute’s value, and attribute’s namespace.&lt;br /&gt;
***We then run the attribute change steps with element, attribute’s local name, null, attribute’s value, and attribute’s namespace.&lt;br /&gt;
***We also append attribute to element’s attribute list.&lt;br /&gt;
***We then set attribute’s element to element. &lt;br /&gt;
**If we want to remove an attribute attribute from an element element, we run these steps:&lt;br /&gt;
***We queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue attribute’s value.&lt;br /&gt;
***If element is custom, we then enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, attribute’s value, null, and attribute’s namespace.&lt;br /&gt;
***We run the attribute change steps with element, attribute’s local name, attribute’s value, null, and attribute’s namespace.&lt;br /&gt;
***We then remove attribute from element’s attribute list.&lt;br /&gt;
***We set attribute’s element to null. &lt;br /&gt;
**If we want to replace an attribute oldAttr by an attribute newAttr in an element element, run these steps:&lt;br /&gt;
***We first queue a mutation record of &amp;quot;attributes&amp;quot; for element with name oldAttr’s local name, namespace oldAttr’s namespace, and oldValue oldAttr’s value.&lt;br /&gt;
***If element is custom, we then enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing oldAttr’s local name, oldAttr’s value, newAttr’s value, and oldAttr’s namespace.&lt;br /&gt;
***We run the attribute change steps with element, oldAttr’s local name, oldAttr’s value, newAttr’s value, and oldAttr’s namespace.&lt;br /&gt;
***We then replace oldAttr by newAttr in element’s attribute list.&lt;br /&gt;
***We set oldAttr’s element to null.&lt;br /&gt;
***We set newAttr’s element to element.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;,, our tests were written with regard to attributes, Childlist, Character data and records of a Mutation Observer. These tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
For this part of the project, our test plan is to check the following:&lt;br /&gt;
*Test the micro task for mutation observer.&lt;br /&gt;
**Check if microtask queued flag is initially unset.&lt;br /&gt;
**Check if the task returns on setting the microtask queued flag.&lt;br /&gt;
**On notifying mutation observers, check if microtask queued flag is unset.&lt;br /&gt;
**Check the size of record queue on notifying mutation observers.&lt;br /&gt;
**Check if the number of events fired is equal to number of slots in Signal list.&lt;br /&gt;
&lt;br /&gt;
*Test the observation of specific mutations:&lt;br /&gt;
**Whenever an observe method is invoked and attributeOldValue or attributeFilter is present and attributes is omitted, check if attributes is set to true.&lt;br /&gt;
**Whenever an observe method is invoked and characterDataOldValue is present and characterData is omitted, check if characterData is set to true.&lt;br /&gt;
**Whenever an observe method is invoked and a TypeError is thrown, check if atleast one of the following scenarios are true.&lt;br /&gt;
***If none of options’ childList, attributes, and characterData is true.&lt;br /&gt;
***attributeOldValue is true and attributes is false.&lt;br /&gt;
***attributeFilter is present and attributes is false.&lt;br /&gt;
***characterDataOldValue is true and characterData is false.&lt;br /&gt;
&lt;br /&gt;
The web-platform tests can be run by giving the following command at the root directory of the project:&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
We have Updated the corresponding test expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in the &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
Our Project follows the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern]&amp;lt;/span&amp;gt;, where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108123</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108123"/>
		<updated>2017-04-07T23:14:10Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Project Design */ Updated the Project Design&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Document_Object_Model DOM]&amp;lt;/span&amp;gt; standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up and Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/srivassumit/servo/wiki/Readme read me]&amp;lt;/span&amp;gt; page of the project's Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
The purpose of this project is to implement the basic functionality required to implement a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutation-observers Mutation Observer API]&amp;lt;/span&amp;gt; as defined in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org DOM]&amp;lt;/span&amp;gt; Specifications.&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;, we implemented the initial Steps as described in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/wiki/Mutation-observer-project Project Specification]&amp;lt;/span&amp;gt;. The initial implementation is merged in the original Servo Repository and the code can be found &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/commit/107ac9ab56c1a4cee3e5f9828f91ab394e3e8eee here]&amp;lt;/span&amp;gt;.&lt;br /&gt;
For the next phase of the project, we have to implement the functionality for supporting Mutation Observers.&lt;br /&gt;
Based on the Project description, we have made a Project Design, which is described in detail below.&lt;br /&gt;
&lt;br /&gt;
=='''Project Design'''==&lt;br /&gt;
&lt;br /&gt;
===Add support for mutation observer microtasks===&lt;br /&gt;
&lt;br /&gt;
*We will add a &amp;lt;code&amp;gt;mutation_observer_compound_microtask_queued&amp;lt;/code&amp;gt; member to the &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt; class. This will be used later to implement the algorithm for ''queuing a mutation observer compound microtask'' and ''notifying a mutation observer'' as described below.&lt;br /&gt;
&lt;br /&gt;
*Then, we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]&amp;lt;/span&amp;gt; by adding a new variant to the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask]&amp;lt;/span&amp;gt; enum for mutation observers. The algorithm for doing that is described below:&lt;br /&gt;
  1) If the &amp;lt;code&amp;gt;mutation observer compound microtask queued&amp;lt;/code&amp;gt; flag is set, then return.&lt;br /&gt;
  2) Set the &amp;lt;code&amp;gt;mutation observer compound microtask queued&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
  3) &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-microtask Queue]&amp;lt;/span&amp;gt; a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[compound microtask]&amp;lt;/span&amp;gt; which will be used to notify the mutation observers.&lt;br /&gt;
&lt;br /&gt;
*Next, we will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers algorithm]&amp;lt;/span&amp;gt; using the vector of observers previously added to the &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt; class. The notify mutation observers algorithm is implemented as described below:&lt;br /&gt;
  1) Unset the mutation observer compound microtask queued flag, which was set in the previous algorithm.&lt;br /&gt;
  2) Declare &amp;lt;code&amp;gt;notifyList&amp;lt;/code&amp;gt; to be a copy of ''unit of related similar-origin browsing contexts''' list of MutationObserver objects.&lt;br /&gt;
  3) Declare &amp;lt;code&amp;gt;signalList&amp;lt;/code&amp;gt; to be a copy of ''unit of related similar-origin browsing contexts''' &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#signal-slot-list signal slot list]&amp;lt;/span&amp;gt;.&lt;br /&gt;
  4) Empty the ''unit of related similar-origin browsing contexts''' signal slot list.&lt;br /&gt;
  5) For each MutationObserver object &amp;lt;code&amp;gt;mo&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;notifyList&amp;lt;/code&amp;gt;, we shall execute a compound microtask subtask to run these steps:&lt;br /&gt;
    1) Declare &amp;lt;code&amp;gt;queue&amp;lt;/code&amp;gt; to contain &amp;lt;code&amp;gt;mo&amp;lt;/code&amp;gt;'s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-mo-queue record queue]&amp;lt;/span&amp;gt;.&lt;br /&gt;
    2) &amp;lt;code&amp;gt;mo&amp;lt;/code&amp;gt;'s &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-mo-queue record queue]&amp;lt;/span&amp;gt; will be emptied.&lt;br /&gt;
    3) All transient registered observers whose observer is &amp;lt;code&amp;gt;mo&amp;lt;/code&amp;gt; will be removed.&lt;br /&gt;
    4) If &amp;lt;code&amp;gt;queue&amp;lt;/code&amp;gt; is non-empty, then invoke &amp;lt;code&amp;gt;mo&amp;lt;/code&amp;gt;’s callback with a list of arguments consisting of &amp;lt;code&amp;gt;queue&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mo&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;mo&amp;lt;/code&amp;gt; as the callback this value. If this throws an exception, then we will report the exception.&lt;br /&gt;
  6) For each [https://dom.spec.whatwg.org/#concept-slot slot] in &amp;lt;code&amp;gt;signalList&amp;lt;/code&amp;gt;, an event named &amp;lt;code&amp;gt;slotchange&amp;lt;/code&amp;gt; will be fired in the same order as it is stored in the &amp;lt;code&amp;gt;signalist&amp;lt;/code&amp;gt;, with its &amp;lt;code&amp;gt;bubbles&amp;lt;/code&amp;gt; attribute set to true, at slot.&lt;br /&gt;
&lt;br /&gt;
===Add support for observing specific mutations===&lt;br /&gt;
*Firstly we will add a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects to &amp;lt;code&amp;gt;Node&amp;lt;/code&amp;gt;.&lt;br /&gt;
*Then we will implement &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationobserver-observe observe]&amp;lt;/span&amp;gt; method of MutationObserver. As per the DOM specification, the observe method has the following behaviour:&lt;br /&gt;
**If either ''options''’ &amp;lt;code&amp;gt;attributeOldValue&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;attributeFilter&amp;lt;/code&amp;gt; is present and ''options''’ &amp;lt;code&amp;gt;attributes&amp;lt;/code&amp;gt; is omitted, then we set the ''options''’ attributes to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;.&lt;br /&gt;
**If options’ characterDataOldValue is present and options’ characterData is omitted, then we set options’ characterData to true.&lt;br /&gt;
**If none of options’ childList, attributes, and characterData is true, then we throw a TypeError.&lt;br /&gt;
**If options’ attributeOldValue is true and options’ attributes is false, then we throw a TypeError.&lt;br /&gt;
**If options’ attributeFilter is present and options’ attributes is false, then we throw a TypeError.&lt;br /&gt;
**If options’ characterDataOldValue is true and options’ characterData is false, then we throw a TypeError.&lt;br /&gt;
**For each observer registered in target’s list of registered observers whose observer is the context object we perform the following steps:&lt;br /&gt;
***We remove all transient registered observers whose source is registered.&lt;br /&gt;
***We also replace registered’s options with options. &lt;br /&gt;
**Otherwise, we add a new registered observer to target’s list of registered observers with the context object as the observer and options as the options, and then also, we add target to context object’s list of nodes on which it is registered. &lt;br /&gt;
**The last two steps above mean we replace an existing matching entry with the new options, or add a new entry if there is no match.&lt;br /&gt;
*We will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record algorithm]&amp;lt;/span&amp;gt;. The queue a mutation record algorithm has the following behavior:&lt;br /&gt;
**We declare the interested observers initially as an empty set of MutationObserver objects optionally paired with a string.&lt;br /&gt;
**We also declare nodes be the inclusive ancestors of target.&lt;br /&gt;
**For each node in nodes, and then for each registered observer (with registered observer’s options as options) in node’s list of registered observers we decide:&lt;br /&gt;
***If none of the following are true&lt;br /&gt;
****node is not target and options’ subtree is false&lt;br /&gt;
****type is &amp;quot;attributes&amp;quot; and options’ attributes is not true&lt;br /&gt;
****type is &amp;quot;attributes&amp;quot;, options’ attributeFilter is present, and options’ attributeFilter does not contain name or namespace is non-null&lt;br /&gt;
****type is &amp;quot;characterData&amp;quot; and options’ characterData is not true&lt;br /&gt;
****type is &amp;quot;childList&amp;quot; and options’ childList is false &lt;br /&gt;
***then,:&lt;br /&gt;
****If registered observer’s observer is not in interested observers, we append registered observer’s observer to interested observers.&lt;br /&gt;
****If either type is &amp;quot;attributes&amp;quot; and options’ attributeOldValue is true, or type is &amp;quot;characterData&amp;quot; and options’ characterDataOldValue is true,we set the paired string of registered observer’s observer in interested observers to oldValue.&lt;br /&gt;
**For each observer in interested observers:&lt;br /&gt;
***We declare record to be a new MutationRecord object with its type set to type and target set to target.&lt;br /&gt;
***If name and namespace are given, we set record’s attributeName to name, and record’s attributeNamespace to namespace.&lt;br /&gt;
***If addedNodes is given, we set record’s addedNodes to addedNodes.&lt;br /&gt;
***If removedNodes is given, we set record’s removedNodes to removedNodes,&lt;br /&gt;
***If previousSibling is given, we set record’s previousSibling to previousSibling.&lt;br /&gt;
***If nextSibling is given, we set record’s nextSibling to nextSibling.&lt;br /&gt;
***If observer has a paired string, we set record’s oldValue to observer’s paired string.&lt;br /&gt;
***We then append record to observer’s record queue. &lt;br /&gt;
**We then queue a mutation observer compound microtask. &lt;br /&gt;
*We will make &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-change changing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing]&amp;lt;/span&amp;gt; an attribute queue a mutation record via &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value]&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute]&amp;lt;/span&amp;gt;, and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&amp;lt;/span&amp;gt;.&lt;br /&gt;
**In order to perform the following tasks, we will follow the steps given after them.&lt;br /&gt;
**If we want to change an attribute attribute from an element element to value, we run these steps:&lt;br /&gt;
***We first queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue attribute’s value.&lt;br /&gt;
***If element is custom, we enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, attribute’s value, value, and attribute’s namespace.&lt;br /&gt;
***We then run the attribute change steps with element, attribute’s local name, attribute’s value, value, and attribute’s namespace.&lt;br /&gt;
***We set attribute’s value to value. &lt;br /&gt;
**If we want to append an attribute attribute to an element element, we run these steps:&lt;br /&gt;
***We queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue null.&lt;br /&gt;
***If element is custom, we enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, null, attribute’s value, and attribute’s namespace.&lt;br /&gt;
***We then run the attribute change steps with element, attribute’s local name, null, attribute’s value, and attribute’s namespace.&lt;br /&gt;
***We also append attribute to element’s attribute list.&lt;br /&gt;
***We then set attribute’s element to element. &lt;br /&gt;
**If we want to remove an attribute attribute from an element element, we run these steps:&lt;br /&gt;
***We queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue attribute’s value.&lt;br /&gt;
***If element is custom, we then enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, attribute’s value, null, and attribute’s namespace.&lt;br /&gt;
***We run the attribute change steps with element, attribute’s local name, attribute’s value, null, and attribute’s namespace.&lt;br /&gt;
***We then remove attribute from element’s attribute list.&lt;br /&gt;
***We set attribute’s element to null. &lt;br /&gt;
**If we want to replace an attribute oldAttr by an attribute newAttr in an element element, run these steps:&lt;br /&gt;
***We first queue a mutation record of &amp;quot;attributes&amp;quot; for element with name oldAttr’s local name, namespace oldAttr’s namespace, and oldValue oldAttr’s value.&lt;br /&gt;
***If element is custom, we then enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing oldAttr’s local name, oldAttr’s value, newAttr’s value, and oldAttr’s namespace.&lt;br /&gt;
***We run the attribute change steps with element, oldAttr’s local name, oldAttr’s value, newAttr’s value, and oldAttr’s namespace.&lt;br /&gt;
***We then replace oldAttr by newAttr in element’s attribute list.&lt;br /&gt;
***We set oldAttr’s element to null.&lt;br /&gt;
***We set newAttr’s element to element.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;,, our tests were written with regard to attributes, Childlist, Character data and records of a Mutation Observer. These tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
For this part of the project, our test plan is to check the following:&lt;br /&gt;
*Test the micro task for mutation observer.&lt;br /&gt;
**Check if microtask queued flag is initially unset.&lt;br /&gt;
**Check if the task returns on setting the microtask queued flag.&lt;br /&gt;
**On notifying mutation observers, check if microtask queued flag is unset.&lt;br /&gt;
**Check the size of record queue on notifying mutation observers.&lt;br /&gt;
**Check if the number of events fired is equal to number of slots in Signal list.&lt;br /&gt;
&lt;br /&gt;
*Test the observation of specific mutations:&lt;br /&gt;
**Whenever an observe method is invoked and attributeOldValue or attributeFilter is present and attributes is omitted, check if attributes is set to true.&lt;br /&gt;
**Whenever an observe method is invoked and characterDataOldValue is present and characterData is omitted, check if characterData is set to true.&lt;br /&gt;
**Whenever an observe method is invoked and a TypeError is thrown, check if atleast one of the following scenarios are true.&lt;br /&gt;
***If none of options’ childList, attributes, and characterData is true.&lt;br /&gt;
***attributeOldValue is true and attributes is false.&lt;br /&gt;
***attributeFilter is present and attributes is false.&lt;br /&gt;
***characterDataOldValue is true and characterData is false.&lt;br /&gt;
&lt;br /&gt;
The web-platform tests can be run by giving the following command at the root directory of the project:&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
We have Updated the corresponding test expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in the &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
Our Project follows the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern]&amp;lt;/span&amp;gt;, where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108115</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108115"/>
		<updated>2017-04-07T22:38:22Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Project Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Document_Object_Model DOM]&amp;lt;/span&amp;gt; standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up and Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/srivassumit/servo/wiki/Readme read me]&amp;lt;/span&amp;gt; page of the project's Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
The purpose of this project is to implement the basic functionality required to implement a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutation-observers Mutation Observer API]&amp;lt;/span&amp;gt; as defined in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org DOM]&amp;lt;/span&amp;gt; Specifications.&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;, we implemented the initial Steps as described in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/wiki/Mutation-observer-project Project Specification]&amp;lt;/span&amp;gt;. The initial implementation is merged in the original Servo Repository and the code can be found &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/commit/107ac9ab56c1a4cee3e5f9828f91ab394e3e8eee here]&amp;lt;/span&amp;gt;.&lt;br /&gt;
For the next phase of the project, we have to implement the functionality for supporting Mutation Observers.&lt;br /&gt;
Based on the Project description, we have made a Project Design, which is described in detail below.&lt;br /&gt;
&lt;br /&gt;
=='''Project Design'''==&lt;br /&gt;
===Add support for mutation observer microtasks===&lt;br /&gt;
*We will add a &amp;lt;code&amp;gt;mutation_observer_compound_microtask_queued&amp;lt;/code&amp;gt; member to &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt;. This will be used later to implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]&amp;lt;/span&amp;gt; described below.&lt;br /&gt;
*Next, we are going to implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]&amp;lt;/span&amp;gt; by adding a new variant to the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask]&amp;lt;/span&amp;gt; enum for mutation observers.&lt;br /&gt;
**Initially, if mutation observer compound microtask queued flag is set, then we return.&lt;br /&gt;
**We have to set mutation observer compound microtask queued flag.&lt;br /&gt;
**The later step will be to queue a compound microtask to notify mutation observers.&lt;br /&gt;
*We will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers algorithm]&amp;lt;/span&amp;gt; (ignoring the specific text about &amp;quot;execute a compound microtask&amp;quot;) using the vector of observers previously added to &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt;. The notify mutation observers algorithm is as below:&lt;br /&gt;
**For this, we need to unset mutation observer compound microtask queued flag set in the previous algorithm.&lt;br /&gt;
**We will declare notifyList to be a copy of unit of related similar-origin browsing contexts' list of MutationObserver objects.&lt;br /&gt;
**Also, we will declare signalList to be a copy of unit of related similar-origin browsing contexts' signal slot list.&lt;br /&gt;
**We need to empty unit of related similar-origin browsing contexts' signal slot list.&lt;br /&gt;
**For each MutationObserver object mo in notifyList, we shall execute a compound microtask subtask to run these steps:&lt;br /&gt;
***Declare queue to contain mo's record queue.&lt;br /&gt;
***mo's record queue will be emptied.&lt;br /&gt;
***All transient registered observers whose observer is mo will be removed.&lt;br /&gt;
***If queue is non-empty, invoke mo’s callback with a list of arguments consisting of queue and mo, and mo as the callback this value. If this throws an exception, report the exception. &lt;br /&gt;
**For each [https://dom.spec.whatwg.org/#concept-slot slot] slot in signalList, in order, we shall fire an event named slotchange, with its bubbles attribute set to true, at slot.&lt;br /&gt;
&lt;br /&gt;
===Add support for observing specific mutations===&lt;br /&gt;
*Firstly we will add a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects to &amp;lt;code&amp;gt;Node&amp;lt;/code&amp;gt;.&lt;br /&gt;
*Then we will implement &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationobserver-observe observe]&amp;lt;/span&amp;gt; method of MutationObserver. As per the DOM specification, the observe method has the following behaviour:&lt;br /&gt;
**If either ''options''’ &amp;lt;code&amp;gt;attributeOldValue&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;attributeFilter&amp;lt;/code&amp;gt; is present and ''options''’ &amp;lt;code&amp;gt;attributes&amp;lt;/code&amp;gt; is omitted, then we set the ''options''’ attributes to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;.&lt;br /&gt;
**If options’ characterDataOldValue is present and options’ characterData is omitted, then we set options’ characterData to true.&lt;br /&gt;
**If none of options’ childList, attributes, and characterData is true, then we throw a TypeError.&lt;br /&gt;
**If options’ attributeOldValue is true and options’ attributes is false, then we throw a TypeError.&lt;br /&gt;
**If options’ attributeFilter is present and options’ attributes is false, then we throw a TypeError.&lt;br /&gt;
**If options’ characterDataOldValue is true and options’ characterData is false, then we throw a TypeError.&lt;br /&gt;
**For each observer registered in target’s list of registered observers whose observer is the context object we perform the following steps:&lt;br /&gt;
***We remove all transient registered observers whose source is registered.&lt;br /&gt;
***We also replace registered’s options with options. &lt;br /&gt;
**Otherwise, we add a new registered observer to target’s list of registered observers with the context object as the observer and options as the options, and then also, we add target to context object’s list of nodes on which it is registered. &lt;br /&gt;
**The last two steps above mean we replace an existing matching entry with the new options, or add a new entry if there is no match.&lt;br /&gt;
*We will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record algorithm]&amp;lt;/span&amp;gt;. The queue a mutation record algorithm has the following behavior:&lt;br /&gt;
**We declare the interested observers initially as an empty set of MutationObserver objects optionally paired with a string.&lt;br /&gt;
**We also declare nodes be the inclusive ancestors of target.&lt;br /&gt;
**For each node in nodes, and then for each registered observer (with registered observer’s options as options) in node’s list of registered observers we decide:&lt;br /&gt;
***If none of the following are true&lt;br /&gt;
****node is not target and options’ subtree is false&lt;br /&gt;
****type is &amp;quot;attributes&amp;quot; and options’ attributes is not true&lt;br /&gt;
****type is &amp;quot;attributes&amp;quot;, options’ attributeFilter is present, and options’ attributeFilter does not contain name or namespace is non-null&lt;br /&gt;
****type is &amp;quot;characterData&amp;quot; and options’ characterData is not true&lt;br /&gt;
****type is &amp;quot;childList&amp;quot; and options’ childList is false &lt;br /&gt;
***then,:&lt;br /&gt;
****If registered observer’s observer is not in interested observers, we append registered observer’s observer to interested observers.&lt;br /&gt;
****If either type is &amp;quot;attributes&amp;quot; and options’ attributeOldValue is true, or type is &amp;quot;characterData&amp;quot; and options’ characterDataOldValue is true,we set the paired string of registered observer’s observer in interested observers to oldValue.&lt;br /&gt;
**For each observer in interested observers:&lt;br /&gt;
***We declare record to be a new MutationRecord object with its type set to type and target set to target.&lt;br /&gt;
***If name and namespace are given, we set record’s attributeName to name, and record’s attributeNamespace to namespace.&lt;br /&gt;
***If addedNodes is given, we set record’s addedNodes to addedNodes.&lt;br /&gt;
***If removedNodes is given, we set record’s removedNodes to removedNodes,&lt;br /&gt;
***If previousSibling is given, we set record’s previousSibling to previousSibling.&lt;br /&gt;
***If nextSibling is given, we set record’s nextSibling to nextSibling.&lt;br /&gt;
***If observer has a paired string, we set record’s oldValue to observer’s paired string.&lt;br /&gt;
***We then append record to observer’s record queue. &lt;br /&gt;
**We then queue a mutation observer compound microtask. &lt;br /&gt;
*We will make &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-change changing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing]&amp;lt;/span&amp;gt; an attribute queue a mutation record via &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value]&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute]&amp;lt;/span&amp;gt;, and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&amp;lt;/span&amp;gt;.&lt;br /&gt;
**In order to perform the following tasks, we will follow the steps given after them.&lt;br /&gt;
**If we want to change an attribute attribute from an element element to value, we run these steps:&lt;br /&gt;
***We first queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue attribute’s value.&lt;br /&gt;
***If element is custom, we enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, attribute’s value, value, and attribute’s namespace.&lt;br /&gt;
***We then run the attribute change steps with element, attribute’s local name, attribute’s value, value, and attribute’s namespace.&lt;br /&gt;
***We set attribute’s value to value. &lt;br /&gt;
**If we want to append an attribute attribute to an element element, we run these steps:&lt;br /&gt;
***We queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue null.&lt;br /&gt;
***If element is custom, we enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, null, attribute’s value, and attribute’s namespace.&lt;br /&gt;
***We then run the attribute change steps with element, attribute’s local name, null, attribute’s value, and attribute’s namespace.&lt;br /&gt;
***We also append attribute to element’s attribute list.&lt;br /&gt;
***We then set attribute’s element to element. &lt;br /&gt;
**If we want to remove an attribute attribute from an element element, we run these steps:&lt;br /&gt;
***We queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue attribute’s value.&lt;br /&gt;
***If element is custom, we then enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, attribute’s value, null, and attribute’s namespace.&lt;br /&gt;
***We run the attribute change steps with element, attribute’s local name, attribute’s value, null, and attribute’s namespace.&lt;br /&gt;
***We then remove attribute from element’s attribute list.&lt;br /&gt;
***We set attribute’s element to null. &lt;br /&gt;
**If we want to replace an attribute oldAttr by an attribute newAttr in an element element, run these steps:&lt;br /&gt;
***We first queue a mutation record of &amp;quot;attributes&amp;quot; for element with name oldAttr’s local name, namespace oldAttr’s namespace, and oldValue oldAttr’s value.&lt;br /&gt;
***If element is custom, we then enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing oldAttr’s local name, oldAttr’s value, newAttr’s value, and oldAttr’s namespace.&lt;br /&gt;
***We run the attribute change steps with element, oldAttr’s local name, oldAttr’s value, newAttr’s value, and oldAttr’s namespace.&lt;br /&gt;
***We then replace oldAttr by newAttr in element’s attribute list.&lt;br /&gt;
***We set oldAttr’s element to null.&lt;br /&gt;
***We set newAttr’s element to element.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;,, our tests were written with regard to attributes, Childlist, Character data and records of a Mutation Observer. These tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
For this part of the project, our test plan is to check the following:&lt;br /&gt;
*Test the micro task for mutation observer.&lt;br /&gt;
**Check if microtask queued flag is initially unset.&lt;br /&gt;
**Check if the task returns on setting the microtask queued flag.&lt;br /&gt;
**On notifying mutation observers, check if microtask queued flag is unset.&lt;br /&gt;
**Check the size of record queue on notifying mutation observers.&lt;br /&gt;
**Check if the number of events fired is equal to number of slots in Signal list.&lt;br /&gt;
&lt;br /&gt;
*Test the observation of specific mutations:&lt;br /&gt;
**Whenever an observe method is invoked and attributeOldValue or attributeFilter is present and attributes is omitted, check if attributes is set to true.&lt;br /&gt;
**Whenever an observe method is invoked and characterDataOldValue is present and characterData is omitted, check if characterData is set to true.&lt;br /&gt;
**Whenever an observe method is invoked and a TypeError is thrown, check if atleast one of the following scenarios are true.&lt;br /&gt;
***If none of options’ childList, attributes, and characterData is true.&lt;br /&gt;
***attributeOldValue is true and attributes is false.&lt;br /&gt;
***attributeFilter is present and attributes is false.&lt;br /&gt;
***characterDataOldValue is true and characterData is false.&lt;br /&gt;
&lt;br /&gt;
The web-platform tests can be run by giving the following command at the root directory of the project:&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
We have Updated the corresponding test expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in the &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
Our Project follows the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern]&amp;lt;/span&amp;gt;, where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108111</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108111"/>
		<updated>2017-04-07T22:36:50Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Project Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Document_Object_Model DOM]&amp;lt;/span&amp;gt; standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up and Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/srivassumit/servo/wiki/Readme read me]&amp;lt;/span&amp;gt; page of the project's Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
The purpose of this project is to implement the basic functionality required to implement a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutation-observers Mutation Observer API]&amp;lt;/span&amp;gt; as defined in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org DOM]&amp;lt;/span&amp;gt; Specifications.&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;, we implemented the initial Steps as described in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/wiki/Mutation-observer-project Project Specification]&amp;lt;/span&amp;gt;. The initial implementation is merged in the original Servo Repository and the code can be found &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/commit/107ac9ab56c1a4cee3e5f9828f91ab394e3e8eee here]&amp;lt;/span&amp;gt;.&lt;br /&gt;
For the next phase of the project, we have to implement the functionality for supporting Mutation Observers.&lt;br /&gt;
&lt;br /&gt;
=='''Project Design'''==&lt;br /&gt;
===Add support for mutation observer microtasks===&lt;br /&gt;
*We will add a &amp;lt;code&amp;gt;mutation_observer_compound_microtask_queued&amp;lt;/code&amp;gt; member to &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt;. This will be used later to implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]&amp;lt;/span&amp;gt; described below.&lt;br /&gt;
*Next, we are going to implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]&amp;lt;/span&amp;gt; by adding a new variant to the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask]&amp;lt;/span&amp;gt; enum for mutation observers.&lt;br /&gt;
**Initially, if mutation observer compound microtask queued flag is set, then we return.&lt;br /&gt;
**We have to set mutation observer compound microtask queued flag.&lt;br /&gt;
**The later step will be to queue a compound microtask to notify mutation observers.&lt;br /&gt;
*We will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers algorithm]&amp;lt;/span&amp;gt; (ignoring the specific text about &amp;quot;execute a compound microtask&amp;quot;) using the vector of observers previously added to &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt;. The notify mutation observers algorithm is as below:&lt;br /&gt;
**For this, we need to unset mutation observer compound microtask queued flag set in the previous algorithm.&lt;br /&gt;
**We will declare notifyList to be a copy of unit of related similar-origin browsing contexts' list of MutationObserver objects.&lt;br /&gt;
**Also, we will declare signalList to be a copy of unit of related similar-origin browsing contexts' signal slot list.&lt;br /&gt;
**We need to empty unit of related similar-origin browsing contexts' signal slot list.&lt;br /&gt;
**For each MutationObserver object mo in notifyList, we shall execute a compound microtask subtask to run these steps:&lt;br /&gt;
***Declare queue to contain mo's record queue.&lt;br /&gt;
***mo's record queue will be emptied.&lt;br /&gt;
***All transient registered observers whose observer is mo will be removed.&lt;br /&gt;
***If queue is non-empty, invoke mo’s callback with a list of arguments consisting of queue and mo, and mo as the callback this value. If this throws an exception, report the exception. &lt;br /&gt;
**For each [https://dom.spec.whatwg.org/#concept-slot slot] slot in signalList, in order, we shall fire an event named slotchange, with its bubbles attribute set to true, at slot.&lt;br /&gt;
&lt;br /&gt;
===Add support for observing specific mutations===&lt;br /&gt;
*Firstly we will add a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects to &amp;lt;code&amp;gt;Node&amp;lt;/code&amp;gt;.&lt;br /&gt;
*Then we will implement &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationobserver-observe observe]&amp;lt;/span&amp;gt; method of MutationObserver. As per the DOM specification, the observe method has the following behaviour:&lt;br /&gt;
**If either ''options''’ &amp;lt;code&amp;gt;attributeOldValue&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;attributeFilter&amp;lt;/code&amp;gt; is present and ''options''’ &amp;lt;code&amp;gt;attributes&amp;lt;/code&amp;gt; is omitted, then we set the ''options''’ attributes to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;.&lt;br /&gt;
**If options’ characterDataOldValue is present and options’ characterData is omitted, then we set options’ characterData to true.&lt;br /&gt;
**If none of options’ childList, attributes, and characterData is true, then we throw a TypeError.&lt;br /&gt;
**If options’ attributeOldValue is true and options’ attributes is false, then we throw a TypeError.&lt;br /&gt;
**If options’ attributeFilter is present and options’ attributes is false, then we throw a TypeError.&lt;br /&gt;
**If options’ characterDataOldValue is true and options’ characterData is false, then we throw a TypeError.&lt;br /&gt;
**For each observer registered in target’s list of registered observers whose observer is the context object we perform the following steps:&lt;br /&gt;
***We remove all transient registered observers whose source is registered.&lt;br /&gt;
***We also replace registered’s options with options. &lt;br /&gt;
**Otherwise, we add a new registered observer to target’s list of registered observers with the context object as the observer and options as the options, and then also, we add target to context object’s list of nodes on which it is registered. &lt;br /&gt;
**The last two steps above mean we replace an existing matching entry with the new options, or add a new entry if there is no match.&lt;br /&gt;
*We will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record algorithm]&amp;lt;/span&amp;gt;. The queue a mutation record algorithm has the following behavior:&lt;br /&gt;
**We declare the interested observers initially as an empty set of MutationObserver objects optionally paired with a string.&lt;br /&gt;
**We also declare nodes be the inclusive ancestors of target.&lt;br /&gt;
**For each node in nodes, and then for each registered observer (with registered observer’s options as options) in node’s list of registered observers we decide:&lt;br /&gt;
***If none of the following are true&lt;br /&gt;
****node is not target and options’ subtree is false&lt;br /&gt;
****type is &amp;quot;attributes&amp;quot; and options’ attributes is not true&lt;br /&gt;
****type is &amp;quot;attributes&amp;quot;, options’ attributeFilter is present, and options’ attributeFilter does not contain name or namespace is non-null&lt;br /&gt;
****type is &amp;quot;characterData&amp;quot; and options’ characterData is not true&lt;br /&gt;
****type is &amp;quot;childList&amp;quot; and options’ childList is false &lt;br /&gt;
***then,:&lt;br /&gt;
****If registered observer’s observer is not in interested observers, we append registered observer’s observer to interested observers.&lt;br /&gt;
****If either type is &amp;quot;attributes&amp;quot; and options’ attributeOldValue is true, or type is &amp;quot;characterData&amp;quot; and options’ characterDataOldValue is true,we set the paired string of registered observer’s observer in interested observers to oldValue.&lt;br /&gt;
**For each observer in interested observers:&lt;br /&gt;
***We declare record to be a new MutationRecord object with its type set to type and target set to target.&lt;br /&gt;
***If name and namespace are given, we set record’s attributeName to name, and record’s attributeNamespace to namespace.&lt;br /&gt;
***If addedNodes is given, we set record’s addedNodes to addedNodes.&lt;br /&gt;
***If removedNodes is given, we set record’s removedNodes to removedNodes,&lt;br /&gt;
***If previousSibling is given, we set record’s previousSibling to previousSibling.&lt;br /&gt;
***If nextSibling is given, we set record’s nextSibling to nextSibling.&lt;br /&gt;
***If observer has a paired string, we set record’s oldValue to observer’s paired string.&lt;br /&gt;
***We then append record to observer’s record queue. &lt;br /&gt;
**We then queue a mutation observer compound microtask. &lt;br /&gt;
*We will make &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-change changing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing]&amp;lt;/span&amp;gt; an attribute queue a mutation record via &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value]&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute]&amp;lt;/span&amp;gt;, and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&amp;lt;/span&amp;gt;.&lt;br /&gt;
**In order to perform the following tasks, we will follow the steps given after them.&lt;br /&gt;
**If we want to change an attribute attribute from an element element to value, we run these steps:&lt;br /&gt;
***We first queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue attribute’s value.&lt;br /&gt;
***If element is custom, we enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, attribute’s value, value, and attribute’s namespace.&lt;br /&gt;
***We then run the attribute change steps with element, attribute’s local name, attribute’s value, value, and attribute’s namespace.&lt;br /&gt;
***We set attribute’s value to value. &lt;br /&gt;
**If we want to append an attribute attribute to an element element, we run these steps:&lt;br /&gt;
***We queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue null.&lt;br /&gt;
***If element is custom, we enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, null, attribute’s value, and attribute’s namespace.&lt;br /&gt;
***We then run the attribute change steps with element, attribute’s local name, null, attribute’s value, and attribute’s namespace.&lt;br /&gt;
***We also append attribute to element’s attribute list.&lt;br /&gt;
***We then set attribute’s element to element. &lt;br /&gt;
**If we want to remove an attribute attribute from an element element, we run these steps:&lt;br /&gt;
***We queue a mutation record of &amp;quot;attributes&amp;quot; for element with name attribute’s local name, namespace attribute’s namespace, and oldValue attribute’s value.&lt;br /&gt;
***If element is custom, we then enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing attribute’s local name, attribute’s value, null, and attribute’s namespace.&lt;br /&gt;
***We run the attribute change steps with element, attribute’s local name, attribute’s value, null, and attribute’s namespace.&lt;br /&gt;
***We then remove attribute from element’s attribute list.&lt;br /&gt;
***We set attribute’s element to null. &lt;br /&gt;
**If we want to replace an attribute oldAttr by an attribute newAttr in an element element, run these steps:&lt;br /&gt;
***We first queue a mutation record of &amp;quot;attributes&amp;quot; for element with name oldAttr’s local name, namespace oldAttr’s namespace, and oldValue oldAttr’s value.&lt;br /&gt;
***If element is custom, we then enqueue a custom element callback reaction with element, callback name &amp;quot;attributeChangedCallback&amp;quot;, and an argument list containing oldAttr’s local name, oldAttr’s value, newAttr’s value, and oldAttr’s namespace.&lt;br /&gt;
***We run the attribute change steps with element, oldAttr’s local name, oldAttr’s value, newAttr’s value, and oldAttr’s namespace.&lt;br /&gt;
***We then replace oldAttr by newAttr in element’s attribute list.&lt;br /&gt;
***We set oldAttr’s element to null.&lt;br /&gt;
***We set newAttr’s element to element.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;,, our tests were written with regard to attributes, Childlist, Character data and records of a Mutation Observer. These tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
For this part of the project, our test plan is to check the following:&lt;br /&gt;
*Test the micro task for mutation observer.&lt;br /&gt;
**Check if microtask queued flag is initially unset.&lt;br /&gt;
**Check if the task returns on setting the microtask queued flag.&lt;br /&gt;
**On notifying mutation observers, check if microtask queued flag is unset.&lt;br /&gt;
**Check the size of record queue on notifying mutation observers.&lt;br /&gt;
**Check if the number of events fired is equal to number of slots in Signal list.&lt;br /&gt;
&lt;br /&gt;
*Test the observation of specific mutations:&lt;br /&gt;
**Whenever an observe method is invoked and attributeOldValue or attributeFilter is present and attributes is omitted, check if attributes is set to true.&lt;br /&gt;
**Whenever an observe method is invoked and characterDataOldValue is present and characterData is omitted, check if characterData is set to true.&lt;br /&gt;
**Whenever an observe method is invoked and a TypeError is thrown, check if atleast one of the following scenarios are true.&lt;br /&gt;
***If none of options’ childList, attributes, and characterData is true.&lt;br /&gt;
***attributeOldValue is true and attributes is false.&lt;br /&gt;
***attributeFilter is present and attributes is false.&lt;br /&gt;
***characterDataOldValue is true and characterData is false&lt;br /&gt;
&lt;br /&gt;
The web-platform tests can be run by giving the following command at the root directory of the project:&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
We have Updated the corresponding test expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in the &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
Our Project follows the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern]&amp;lt;/span&amp;gt;, where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108096</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108096"/>
		<updated>2017-04-07T22:04:28Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Add support for observing specific mutations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Document_Object_Model DOM]&amp;lt;/span&amp;gt; standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up and Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/srivassumit/servo/wiki/Readme read me]&amp;lt;/span&amp;gt; page of the project's Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
The purpose of this project is to implement the basic functionality required to implement a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutation-observers Mutation Observer API]&amp;lt;/span&amp;gt; as defined in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org DOM]&amp;lt;/span&amp;gt; Specifications.&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;, we implemented the initial Steps as described in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/wiki/Mutation-observer-project Project Specification]&amp;lt;/span&amp;gt;. The initial implementation is merged in the original Servo Repository and the code can be found &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/commit/107ac9ab56c1a4cee3e5f9828f91ab394e3e8eee here]&amp;lt;/span&amp;gt;.&lt;br /&gt;
For the next phase of the project, we have to implement the functionality for supporting Mutation Observers. We plan on acheiving that in the following steps:&lt;br /&gt;
&lt;br /&gt;
===Add support for mutation observer microtasks===&lt;br /&gt;
*We will add a &amp;lt;code&amp;gt;mutation_observer_compound_microtask_queued&amp;lt;/code&amp;gt; member to &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt;. This will be used later to implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]&amp;lt;/span&amp;gt; described below.&lt;br /&gt;
*Next, we are going to implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]&amp;lt;/span&amp;gt; by adding a new variant to the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask]&amp;lt;/span&amp;gt; enum for mutation observers.&lt;br /&gt;
**Initially, if mutation observer compound microtask queued flag is set, then we return.&lt;br /&gt;
**We have to set mutation observer compound microtask queued flag.&lt;br /&gt;
**The later step will be to queue a compound microtask to notify mutation observers.&lt;br /&gt;
*We will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers algorithm]&amp;lt;/span&amp;gt; (ignoring the specific text about &amp;quot;execute a compound microtask&amp;quot;) using the vector of observers previously added to &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt;. The notify mutation observers algorithm is as below:&lt;br /&gt;
**For this, we need to unset mutation observer compound microtask queued flag set in the previous algorithm.&lt;br /&gt;
**We will declare notifyList to be a copy of unit of related similar-origin browsing contexts' list of MutationObserver objects.&lt;br /&gt;
**Also, we will declare signalList to be a copy of unit of related similar-origin browsing contexts' signal slot list.&lt;br /&gt;
**We need to empty unit of related similar-origin browsing contexts' signal slot list.&lt;br /&gt;
**For each MutationObserver object mo in notifyList, we shall execute a compound microtask subtask to run these steps:&lt;br /&gt;
***Declare queue to contain mo's record queue.&lt;br /&gt;
***mo's record queue will be emptied.&lt;br /&gt;
***All transient registered observers whose observer is mo will be removed.&lt;br /&gt;
***If queue is non-empty, invoke mo’s callback with a list of arguments consisting of queue and mo, and mo as the callback this value. If this throws an exception, report the exception. &lt;br /&gt;
**For each [https://dom.spec.whatwg.org/#concept-slot slot] slot in signalList, in order, we shall fire an event named slotchange, with its bubbles attribute set to true, at slot.&lt;br /&gt;
&lt;br /&gt;
===Add support for observing specific mutations===&lt;br /&gt;
*Firstly we will add a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects to &amp;lt;code&amp;gt;Node&amp;lt;/code&amp;gt;.&lt;br /&gt;
*Then we will implement &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationobserver-observe observe]&amp;lt;/span&amp;gt; method of MutationObserver. As per the DOM specification, the observe method has the following behaviour:&lt;br /&gt;
**If either ''options''’ &amp;lt;code&amp;gt;attributeOldValue&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;attributeFilter&amp;lt;/code&amp;gt; is present and ''options''’ &amp;lt;code&amp;gt;attributes&amp;lt;/code&amp;gt; is omitted, then we set the ''options''’ attributes to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;.&lt;br /&gt;
*We will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record algorithm]&amp;lt;/span&amp;gt;.&lt;br /&gt;
*We will make &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-change changing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing]&amp;lt;/span&amp;gt; an attribute queue a mutation record via &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value]&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute]&amp;lt;/span&amp;gt;, and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
In the first phase of the project, our tests were written with regard to attributes, Childlist, Character data and records of a Mutation Observer. These tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
For this part of the project, our test plan is to check the following:&lt;br /&gt;
*Test the micro task for mutation observer.&lt;br /&gt;
**Check if microtask queued flag is initially unset.&lt;br /&gt;
**Check if the task returns on setting the microtask queued flag.&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The web-platform tests can be run by giving the following command at the root directory of the project:&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
We have Updated the corresponding test expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in the &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
Our Project follows the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern]&amp;lt;/span&amp;gt;, where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108095</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108095"/>
		<updated>2017-04-07T22:04:05Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Add support for observing specific mutations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Document_Object_Model DOM]&amp;lt;/span&amp;gt; standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up and Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/srivassumit/servo/wiki/Readme read me]&amp;lt;/span&amp;gt; page of the project's Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
The purpose of this project is to implement the basic functionality required to implement a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutation-observers Mutation Observer API]&amp;lt;/span&amp;gt; as defined in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org DOM]&amp;lt;/span&amp;gt; Specifications.&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;, we implemented the initial Steps as described in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/wiki/Mutation-observer-project Project Specification]&amp;lt;/span&amp;gt;. The initial implementation is merged in the original Servo Repository and the code can be found &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/commit/107ac9ab56c1a4cee3e5f9828f91ab394e3e8eee here]&amp;lt;/span&amp;gt;.&lt;br /&gt;
For the next phase of the project, we have to implement the functionality for supporting Mutation Observers. We plan on acheiving that in the following steps:&lt;br /&gt;
&lt;br /&gt;
===Add support for mutation observer microtasks===&lt;br /&gt;
*We will add a &amp;lt;code&amp;gt;mutation_observer_compound_microtask_queued&amp;lt;/code&amp;gt; member to &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt;. This will be used later to implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]&amp;lt;/span&amp;gt; described below.&lt;br /&gt;
*Next, we are going to implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]&amp;lt;/span&amp;gt; by adding a new variant to the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask]&amp;lt;/span&amp;gt; enum for mutation observers.&lt;br /&gt;
**Initially, if mutation observer compound microtask queued flag is set, then we return.&lt;br /&gt;
**We have to set mutation observer compound microtask queued flag.&lt;br /&gt;
**The later step will be to queue a compound microtask to notify mutation observers.&lt;br /&gt;
*We will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers algorithm]&amp;lt;/span&amp;gt; (ignoring the specific text about &amp;quot;execute a compound microtask&amp;quot;) using the vector of observers previously added to &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt;. The notify mutation observers algorithm is as below:&lt;br /&gt;
**For this, we need to unset mutation observer compound microtask queued flag set in the previous algorithm.&lt;br /&gt;
**We will declare notifyList to be a copy of unit of related similar-origin browsing contexts' list of MutationObserver objects.&lt;br /&gt;
**Also, we will declare signalList to be a copy of unit of related similar-origin browsing contexts' signal slot list.&lt;br /&gt;
**We need to empty unit of related similar-origin browsing contexts' signal slot list.&lt;br /&gt;
**For each MutationObserver object mo in notifyList, we shall execute a compound microtask subtask to run these steps:&lt;br /&gt;
***Declare queue to contain mo's record queue.&lt;br /&gt;
***mo's record queue will be emptied.&lt;br /&gt;
***All transient registered observers whose observer is mo will be removed.&lt;br /&gt;
***If queue is non-empty, invoke mo’s callback with a list of arguments consisting of queue and mo, and mo as the callback this value. If this throws an exception, report the exception. &lt;br /&gt;
**For each [https://dom.spec.whatwg.org/#concept-slot slot] slot in signalList, in order, we shall fire an event named slotchange, with its bubbles attribute set to true, at slot.&lt;br /&gt;
&lt;br /&gt;
===Add support for observing specific mutations===&lt;br /&gt;
*Firstly we will add a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects to &amp;lt;code&amp;gt;Node&amp;lt;/code&amp;gt;.&lt;br /&gt;
*Then we will implement &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationobserver-observe observe]&amp;lt;/span&amp;gt; method of MutationObserver. As per the DOM specification, the observe method has the following behaviour:&lt;br /&gt;
**If either ''options''’ &amp;lt;code&amp;gt;attributeOldValue&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;attributeFilter&amp;lt;/code&amp;gt; is present and ''options''’ &amp;lt;code&amp;gt;attributes/code&amp;gt; is omitted, then we set the ''options''’ attributes to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;.&lt;br /&gt;
*We will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record algorithm]&amp;lt;/span&amp;gt;.&lt;br /&gt;
*We will make &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-change changing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing]&amp;lt;/span&amp;gt; an attribute queue a mutation record via &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value]&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute]&amp;lt;/span&amp;gt;, and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
In the first phase of the project, our tests were written with regard to attributes, Childlist, Character data and records of a Mutation Observer. These tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
For this part of the project, our test plan is to check the following:&lt;br /&gt;
*Test the micro task for mutation observer.&lt;br /&gt;
**Check if microtask queued flag is initially unset.&lt;br /&gt;
**Check if the task returns on setting the microtask queued flag.&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The web-platform tests can be run by giving the following command at the root directory of the project:&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
We have Updated the corresponding test expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in the &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
Our Project follows the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern]&amp;lt;/span&amp;gt;, where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108075</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=108075"/>
		<updated>2017-04-07T21:31:45Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Project Description */ Updated the project description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Document_Object_Model DOM]&amp;lt;/span&amp;gt; standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up and Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/srivassumit/servo/wiki/Readme read me]&amp;lt;/span&amp;gt; page of the project's Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
The purpose of this project is to implement the basic functionality required to implement a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#mutation-observers Mutation Observer API]&amp;lt;/span&amp;gt; as defined in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org DOM]&amp;lt;/span&amp;gt; Specifications.&lt;br /&gt;
In the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]&amp;lt;/span&amp;gt;, we implemented the initial Steps as described in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/wiki/Mutation-observer-project Project Specification]&amp;lt;/span&amp;gt;. The initial implementation is merged in the original Servo Repository and the code can be found &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/commit/107ac9ab56c1a4cee3e5f9828f91ab394e3e8eee here]&amp;lt;/span&amp;gt;.&lt;br /&gt;
For the next phase of the project, we have to implement the functionality for supporting Mutation Observers. We plan on acheiving that in the following steps:&lt;br /&gt;
&lt;br /&gt;
===Add support for mutation observer microtasks===&lt;br /&gt;
*We will add a &amp;lt;code&amp;gt;mutation_observer_compound_microtask_queued&amp;lt;/code&amp;gt; member to &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt;. This will be used later to implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]&amp;lt;/span&amp;gt; described below.&lt;br /&gt;
*Next, we are going to implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]&amp;lt;/span&amp;gt; by adding a new variant to the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask]&amp;lt;/span&amp;gt; enum for mutation observers.&lt;br /&gt;
**&lt;br /&gt;
*We will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers algorithm]&amp;lt;/span&amp;gt; (ignoring the specific text about &amp;quot;execute a compound microtask&amp;quot;) using the vector of observers previously added to &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Add support for observing specific mutations===&lt;br /&gt;
*We will add a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects to &amp;lt;code&amp;gt;Node&amp;lt;/code&amp;gt;.&lt;br /&gt;
*We will implement &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationobserver-observe MutationObserver.observe]&amp;lt;/span&amp;gt; (step 7 and 8 mean &amp;quot;replace an existing matching entry with the new options, or add a new entry if there is no match&amp;quot;).&lt;br /&gt;
*We will implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record algorithm]&amp;lt;/span&amp;gt;.&lt;br /&gt;
*We will make &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-change changing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing]&amp;lt;/span&amp;gt; an attribute queue a mutation record via &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value]&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute]&amp;lt;/span&amp;gt;, and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
Our Project follows the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern]&amp;lt;/span&amp;gt;, where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107920</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107920"/>
		<updated>2017-04-05T19:54:10Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Project Description */ updated the code snippets to the latest submitted and merged version&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Document_Object_Model DOM]&amp;lt;/span&amp;gt; standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Tracking issue'''==&lt;br /&gt;
The Original Tracking Issue for the project can be found at the [https://github.com/servo/servo/issues/6633 Tracking Issue] page of the [https://github.com/servo/servo/wiki/Mutation-observer-project Mutation Observer Project].&lt;br /&gt;
&lt;br /&gt;
=='''Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the [https://github.com/srivassumit/servo/wiki/Readme Read me] file of the project Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
*The changes made for the project are as per the initial steps given &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/wiki/Mutation-observer-project here]&amp;lt;/span&amp;gt;.&lt;br /&gt;
'''Initial steps for Stub method Implementation''':&lt;br /&gt;
*Forked the original (Servo)[https://github.com/servo/servo] repository into our GitHub account and created a new Branch (MutationObserver-dev)[https://github.com/srivassumit/servo/tree/MutationObserver-dev] for pushing our changes.&lt;br /&gt;
**Created the [https://dom.spec.whatwg.org/#mutationobserver MutationObserver] and [https://dom.spec.whatwg.org/#mutationrecord MutationRecord] interfaces with stub method implementations following the guidelines given here: [http://doc.servo.org/script/dom/index.html#adding-a-new-dom-interface Adding a new DOM Interface]&lt;br /&gt;
***The IDL Files describe the Structure of the Mutation Observer and Mutation Record classes:&lt;br /&gt;
    '''MutationObserver IDL'''&lt;br /&gt;
    [Constructor(MutationCallback callback)]&lt;br /&gt;
    interface MutationObserver {&lt;br /&gt;
      //void observe(Node target, optional MutationObserverInit options);&lt;br /&gt;
      //void disconnect();&lt;br /&gt;
      //sequence&amp;lt;MutationRecord&amp;gt; takeRecords();&lt;br /&gt;
    };&lt;br /&gt;
    &lt;br /&gt;
    callback MutationCallback  = void (sequence&amp;lt;MutationRecord&amp;gt; mutations, MutationObserver observer);&lt;br /&gt;
    &lt;br /&gt;
    dictionary MutationObserverInit {&lt;br /&gt;
      boolean childList = false;&lt;br /&gt;
      boolean attributes;&lt;br /&gt;
      boolean characterData;&lt;br /&gt;
      boolean subtree = false;&lt;br /&gt;
      boolean attributeOldValue;&lt;br /&gt;
      boolean characterDataOldValue;&lt;br /&gt;
      sequence&amp;lt;DOMString&amp;gt; attributeFilter;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    '''MutationRecord IDL'''&lt;br /&gt;
    [Exposed=Window]&lt;br /&gt;
    interface MutationRecord {&lt;br /&gt;
      readonly attribute DOMString type;&lt;br /&gt;
      [SameObject] readonly attribute Node target;&lt;br /&gt;
      //[SameObject] readonly attribute NodeList addedNodes;&lt;br /&gt;
      //[SameObject] readonly attribute NodeList removedNodes;&lt;br /&gt;
      //readonly attribute Node? previousSibling;&lt;br /&gt;
      //readonly attribute Node? nextSibling;&lt;br /&gt;
      //readonly attribute DOMString? attributeName;&lt;br /&gt;
      //readonly attribute DOMString? attributeNamespace;&lt;br /&gt;
      //readonly attribute DOMString? oldValue;&lt;br /&gt;
    };&lt;br /&gt;
*** Added the new interfaces in the dom scripts folder.&lt;br /&gt;
**mutationobserver.rs contains the implementation of the MutationObserver IDL interface.&lt;br /&gt;
    '''components/script/dom/mutationobserver.rs'''&lt;br /&gt;
    use dom::bindings::codegen::Bindings::MutationObserverBinding;&lt;br /&gt;
    use dom::bindings::codegen::Bindings::MutationObserverBinding::MutationCallback;&lt;br /&gt;
    use dom::bindings::error::Fallible;&lt;br /&gt;
    use dom::bindings::js::Root;&lt;br /&gt;
    use dom::bindings::reflector::{Reflector, reflect_dom_object};&lt;br /&gt;
    use dom::window::Window;&lt;br /&gt;
    use dom_struct::dom_struct;&lt;br /&gt;
    use script_thread::ScriptThread;&lt;br /&gt;
    use std::rc::Rc;&lt;br /&gt;
    &lt;br /&gt;
    #[dom_struct]&lt;br /&gt;
    pub struct MutationObserver {&lt;br /&gt;
        reflector_: Reflector,&lt;br /&gt;
        #[ignore_heap_size_of = &amp;quot;can't measure Rc values&amp;quot;]&lt;br /&gt;
        callback: Rc&amp;lt;MutationCallback&amp;gt;,&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationObserver {&lt;br /&gt;
        fn new(global: &amp;amp;Window, callback: Rc&amp;lt;MutationCallback&amp;gt;) -&amp;gt; Root&amp;lt;MutationObserver&amp;gt; {&lt;br /&gt;
            let boxed_observer = box MutationObserver::new_inherited(callback);&lt;br /&gt;
            reflect_dom_object(boxed_observer, global, MutationObserverBinding::Wrap)&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        fn new_inherited(callback: Rc&amp;lt;MutationCallback&amp;gt;) -&amp;gt; MutationObserver {&lt;br /&gt;
            MutationObserver {&lt;br /&gt;
                reflector_: Reflector::new(),&lt;br /&gt;
                callback: callback,&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        pub fn Constructor(global: &amp;amp;Window, callback: Rc&amp;lt;MutationCallback&amp;gt;) -&amp;gt; Fallible&amp;lt;Root&amp;lt;MutationObserver&amp;gt;&amp;gt; {&lt;br /&gt;
            let observer = MutationObserver::new(global, callback);&lt;br /&gt;
            ScriptThread::add_mutation_observer(&amp;amp;*observer);&lt;br /&gt;
            Ok(observer)&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
**mutationrecord.rs contains the implementation of the MutationRecord IDL interface. It also contains the 'getter' functions for the private methods. &lt;br /&gt;
    '''components/script/dom/mutationrecord.rs'''&lt;br /&gt;
    use dom::bindings::codegen::Bindings::MutationRecordBinding::MutationRecordBinding::MutationRecordMethods;&lt;br /&gt;
    use dom::bindings::js::{JS, Root};&lt;br /&gt;
    use dom::bindings::reflector::Reflector;&lt;br /&gt;
    use dom::bindings::str::DOMString;&lt;br /&gt;
    use dom::node::Node;&lt;br /&gt;
    use dom_struct::dom_struct;&lt;br /&gt;
    &lt;br /&gt;
    #[dom_struct]&lt;br /&gt;
    pub struct MutationRecord {&lt;br /&gt;
        reflector_: Reflector,&lt;br /&gt;
    &lt;br /&gt;
        //property for record type&lt;br /&gt;
        record_type: DOMString,&lt;br /&gt;
    &lt;br /&gt;
        //property for target node&lt;br /&gt;
        target: JS&amp;lt;Node&amp;gt;,&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationRecordMethods for MutationRecord {&lt;br /&gt;
        // https://dom.spec.whatwg.org/#dom-mutationrecord-type&lt;br /&gt;
        fn Type(&amp;amp;self) -&amp;gt; DOMString {&lt;br /&gt;
            self.record_type.clone()&lt;br /&gt;
        }&lt;br /&gt;
    &lt;br /&gt;
        // https://dom.spec.whatwg.org/#dom-mutationrecord-target&lt;br /&gt;
        fn Target(&amp;amp;self) -&amp;gt; Root&amp;lt;Node&amp;gt; {&lt;br /&gt;
            return Root::from_ref(&amp;amp;*self.target);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
***Added the new interfaces in the &amp;lt;code&amp;gt;mod.rs&amp;lt;/code&amp;gt; file:&lt;br /&gt;
    '''components/script/dom/mod.rs'''&lt;br /&gt;
    ...&lt;br /&gt;
    pub mod mutationobserver;&lt;br /&gt;
    pub mod mutationrecord;&lt;br /&gt;
    ...&lt;br /&gt;
**We hid the new interfaces by default by adding a &amp;lt;code&amp;gt;[Pref=&amp;quot;dom.mutation_observer.enabled&amp;quot;]&amp;lt;/code&amp;gt; attribute to both &amp;lt;code&amp;gt;mutationobserver.rs&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mutationrecord.rs&amp;lt;/code&amp;gt; and added a corresponding preference to &amp;lt;code&amp;gt;resources/prefs.json&amp;lt;/code&amp;gt; file.&lt;br /&gt;
    '''resources/prefs.json'''&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;quot;dom.mutation_observer.enabled&amp;quot;: false,&lt;br /&gt;
    ...&lt;br /&gt;
*We added a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects as a member of the [https://github.com/servo/servo/blob/3c8daca772aacf59bffdff32b017f8029437a85e/components/script/script_thread.rs#L397 ScriptThread] as mentioed in the requirements.&lt;br /&gt;
    '''components/script/script_thread.rs'''&lt;br /&gt;
    ...&lt;br /&gt;
    pub struct ScriptThread {&lt;br /&gt;
      ...&lt;br /&gt;
      /// a vector of MutationObserver objects&lt;br /&gt;
      mutation_observers: DOMRefCell&amp;lt;Vec&amp;lt;JS&amp;lt;MutationObserver&amp;gt;&amp;gt;&amp;gt;,&lt;br /&gt;
      ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
    impl ScriptThread {&lt;br /&gt;
        ...&lt;br /&gt;
        pub fn add_mutation_observer(observer: &amp;amp;MutationObserver) {&lt;br /&gt;
            SCRIPT_THREAD_ROOT.with(|root| {&lt;br /&gt;
                let script_thread = unsafe { &amp;amp;*root.get().unwrap() };&lt;br /&gt;
                script_thread.mutation_observers.borrow_mut().push(JS::from_ref(observer));&lt;br /&gt;
            })&lt;br /&gt;
        }&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
*Implemented the &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; constructor, by following the steps given in the [https://dom.spec.whatwg.org/#dom-mutationobserver-mutationobserver DOM Specifications].&lt;br /&gt;
    '''components/script/dom/mutationobserver.rs'''&lt;br /&gt;
    ...&lt;br /&gt;
    pub fn Constructor(global: &amp;amp;Window, callback: Rc&amp;lt;MutationCallback&amp;gt;) -&amp;gt; Fallible&amp;lt;Root&amp;lt;MutationObserver&amp;gt;&amp;gt; {&lt;br /&gt;
        let observer = MutationObserver::new(global, callback);&lt;br /&gt;
        ScriptThread::add_mutation_observer(&amp;amp;*observer);&lt;br /&gt;
        Ok(observer)&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
*Tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
* The following are the tests written with regard to attributes of a Mutation Observer ( i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes/MutationObserver-attributes.html&amp;lt;/code&amp;gt;).&lt;br /&gt;
** The scenario where there is no old attribute in the document and an update happens on the attribute.&lt;br /&gt;
** The scenario where there is a old attribute and an update happens.&lt;br /&gt;
** The scenario where the old attribute is an empty string.&lt;br /&gt;
** The scenario where the new update is the same as the old value.&lt;br /&gt;
** The scenario where multiple attributes in a document are updated.&lt;br /&gt;
** The scenario where there is invalid character in the updated attribute.&lt;br /&gt;
** The scenario where multiple old attributes are removed.&lt;br /&gt;
** The scenario where new attribute is added.&lt;br /&gt;
** The scenario where there is no Childlist in the mutation.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
* The following are the tests written with regard to Childlist of a Mutation Observer ( i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes/MutationObserver-childList.html&amp;lt;/code&amp;gt;).&lt;br /&gt;
** The scenario where there is no mutation in the Childlist node.&lt;br /&gt;
** The scenario where there is updation on the contents of Childlist node.&lt;br /&gt;
** The scenario where there is updation on the contents of Childlist node on a previously empty content.&lt;br /&gt;
** The scenario where there is removal of contents in the Childlist node.&lt;br /&gt;
** The scenario where there is both addition and removal of contents in the Childlist node.&lt;br /&gt;
** The scenario where there is addition of contents into the last Child.&lt;br /&gt;
** The scenario where we append a child to Childlist node.&lt;br /&gt;
** The scenario where a child is removed.&lt;br /&gt;
** The scenario where both child and data is removed.&lt;br /&gt;
** The scenario where a child is inserted.&lt;br /&gt;
** The scenario where children are inserted.&lt;br /&gt;
** The scenario where children are both removed and added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The following are the tests written with regard to Character data of a Mutation Observer ( i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes/MutationObserver-characterData.html&amp;lt;/code&amp;gt;).&lt;br /&gt;
** The scenario where there is a updation without old data.&lt;br /&gt;
** The scenario where there is a updation with an old data.&lt;br /&gt;
** The scenario where there is a addition to an existing data.&lt;br /&gt;
** The scenario where there is a addition to an empty string.&lt;br /&gt;
** The scenario where there is a removal of data and an empty string is created.&lt;br /&gt;
** The scenario when a child is removed and data is updated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The following are the tests written with regard to Records of a Mutation Observer ( i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes/MutationObserver-takeRecords.html&amp;lt;/code&amp;gt;).&lt;br /&gt;
** The test to check if attributes, Child list and Character Data are present or not.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Added a &amp;lt;code&amp;gt;__dir__.ini &amp;lt;/code&amp;gt; file to &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; for enabling the new preference by including &amp;lt;code&amp;gt;&amp;quot;prefs: [&amp;quot;dom.mutation_observer.enabled:true&amp;quot;]&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
    '''tests/wpt/metadata/dom/nodes/__dir__.ini'''&lt;br /&gt;
    prefs: [&amp;quot;dom.mutation_observer.enabled:true&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*The web-platform tests can be run by giving the following command at the root directory of the project:&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
*We have Updated the corresponding test expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in the &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
Our Project follows the [https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern], where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
After making the above mentioned changes, we can create the Mutation Observer Object using the Constructor which we have implemented.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Subsequent Steps'''==&lt;br /&gt;
After completing the above initial steps, we plan on performing the following tasks:&lt;br /&gt;
&lt;br /&gt;
*add support for mutation observer microtasks&lt;br /&gt;
**add a mutation_observer_compound_microtask_queued member to ScriptThread&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask] algorithm by adding a new variant to the [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask] enum for mutation observers&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers] algorithm (ignoring the specific text about &amp;quot;execute a compound microtask&amp;quot;) using the vector of observers previously added to ScriptThread&lt;br /&gt;
*add support for observing specific mutations&lt;br /&gt;
**add a vector of MutationObserver objects to Node&lt;br /&gt;
**implement [https://dom.spec.whatwg.org/#dom-mutationobserver-observe MutationObserver.observe] (step 7 and 8 mean &amp;quot;replace an existing matching entry with the new options, or add a new entry if there is no match&amp;quot;)&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record] algorithm&lt;br /&gt;
**make [https://dom.spec.whatwg.org/#concept-element-attributes-change changing]/[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]/[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]/[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing] an attribute queue a mutation record via [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value], [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute], and [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&lt;br /&gt;
&lt;br /&gt;
=='''Commit Frequency'''==&lt;br /&gt;
As per the guidelines of the Mozilla project, all the changes will be submitted in a single commit.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=107919</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=107919"/>
		<updated>2017-04-05T19:34:15Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Project Description */ formatted some links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Document_Object_Model DOM]&amp;lt;/span&amp;gt; standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up and Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/srivassumit/servo/wiki/Readme read me]&amp;lt;/span&amp;gt; page of the project's Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
In the first Phase of the Project, we implemented the initial Steps as described in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/wiki/Mutation-observer-project Project Specification]&amp;lt;/span&amp;gt;. The initial implementation is merged in the original Servo Repository and the code can be found &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/commit/107ac9ab56c1a4cee3e5f9828f91ab394e3e8eee here]&amp;lt;/span&amp;gt;.&lt;br /&gt;
For the next phase of the project, we have to implement the following steps:&lt;br /&gt;
&lt;br /&gt;
*add support for mutation observer microtasks&lt;br /&gt;
**add a &amp;lt;code&amp;gt;mutation_observer_compound_microtask_queued&amp;lt;/code&amp;gt; member to &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt;.&lt;br /&gt;
**implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]&amp;lt;/span&amp;gt; by adding a new variant to the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask]&amp;lt;/span&amp;gt; enum for mutation observers.&lt;br /&gt;
**implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers algorithm]&amp;lt;/span&amp;gt; (ignoring the specific text about &amp;quot;execute a compound microtask&amp;quot;) using the vector of observers previously added to &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
*add support for observing specific mutations&lt;br /&gt;
**add a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects to Node.&lt;br /&gt;
**implement &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationobserver-observe MutationObserver.observe]&amp;lt;/span&amp;gt; (step 7 and 8 mean &amp;quot;replace an existing matching entry with the new options, or add a new entry if there is no match&amp;quot;).&lt;br /&gt;
**implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record algorithm]&amp;lt;/span&amp;gt;.&lt;br /&gt;
**make &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-change changing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing]&amp;lt;/span&amp;gt; an attribute queue a mutation record via &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value]&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute]&amp;lt;/span&amp;gt;, and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
Our Project follows the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern]&amp;lt;/span&amp;gt;, where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=107918</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=107918"/>
		<updated>2017-04-05T19:32:22Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Design Pattern */ corrected broken link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Document_Object_Model DOM]&amp;lt;/span&amp;gt; standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up and Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/srivassumit/servo/wiki/Readme read me]&amp;lt;/span&amp;gt; page of the project's Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
In the first Phase of the Project, we implemented the initial Steps as described in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/wiki/Mutation-observer-project Project Specification]&amp;lt;/span&amp;gt;. The initial implementation is merged in the original Servo Repository and the code can be found &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/commit/107ac9ab56c1a4cee3e5f9828f91ab394e3e8eee here]&amp;lt;/span&amp;gt;.&lt;br /&gt;
For the next phase of the project, we have to implement the following steps:&lt;br /&gt;
&lt;br /&gt;
*add support for mutation observer microtasks&lt;br /&gt;
**add a &amp;lt;code&amp;gt;mutation_observer_compound_microtask_queued&amp;lt;/code&amp;gt; member to &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt;.&lt;br /&gt;
**implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]&amp;lt;/span&amp;gt; by adding a new variant to the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask]&amp;lt;/span&amp;gt; enum for mutation observers.&lt;br /&gt;
**implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers algorithm]&amp;lt;/span&amp;gt; (ignoring the specific text about &amp;quot;execute a compound microtask&amp;quot;) using the vector of observers previously added to &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
*add support for observing specific mutations&lt;br /&gt;
**add a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects to Node.&lt;br /&gt;
**implement &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationobserver-observe MutationObserver.observe]&amp;lt;/span&amp;gt; (step 7 and 8 mean &amp;quot;replace an existing matching entry with the new options, or add a new entry if there is no match&amp;quot;).&lt;br /&gt;
**implement the &amp;lt;span class=&amp;quot;&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record algorithm]&amp;lt;/span&amp;gt;.&lt;br /&gt;
**make &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-change changing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing]&amp;lt;/span&amp;gt; an attribute queue a mutation record via &amp;lt;span&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value]&amp;lt;/span&amp;gt;, &amp;lt;span&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute]&amp;lt;/span&amp;gt;, and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
Our Project follows the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern]&amp;lt;/span&amp;gt;, where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=107917</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API_Design&amp;diff=107917"/>
		<updated>2017-04-05T19:31:42Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: created the initial page structure and description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Document_Object_Model DOM]&amp;lt;/span&amp;gt; standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up and Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/srivassumit/servo/wiki/Readme read me]&amp;lt;/span&amp;gt; page of the project's Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
In the first Phase of the Project, we implemented the initial Steps as described in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/wiki/Mutation-observer-project Project Specification]&amp;lt;/span&amp;gt;. The initial implementation is merged in the original Servo Repository and the code can be found &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/servo/servo/commit/107ac9ab56c1a4cee3e5f9828f91ab394e3e8eee here]&amp;lt;/span&amp;gt;.&lt;br /&gt;
For the next phase of the project, we have to implement the following steps:&lt;br /&gt;
&lt;br /&gt;
*add support for mutation observer microtasks&lt;br /&gt;
**add a &amp;lt;code&amp;gt;mutation_observer_compound_microtask_queued&amp;lt;/code&amp;gt; member to &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt;.&lt;br /&gt;
**implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]&amp;lt;/span&amp;gt; by adding a new variant to the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask]&amp;lt;/span&amp;gt; enum for mutation observers.&lt;br /&gt;
**implement the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers algorithm]&amp;lt;/span&amp;gt; (ignoring the specific text about &amp;quot;execute a compound microtask&amp;quot;) using the vector of observers previously added to &amp;lt;code&amp;gt;ScriptThread&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
*add support for observing specific mutations&lt;br /&gt;
**add a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects to Node.&lt;br /&gt;
**implement &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#dom-mutationobserver-observe MutationObserver.observe]&amp;lt;/span&amp;gt; (step 7 and 8 mean &amp;quot;replace an existing matching entry with the new options, or add a new entry if there is no match&amp;quot;).&lt;br /&gt;
**implement the &amp;lt;span class=&amp;quot;&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record algorithm]&amp;lt;/span&amp;gt;.&lt;br /&gt;
**make &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-change changing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]&amp;lt;/span&amp;gt;/&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing]&amp;lt;/span&amp;gt; an attribute queue a mutation record via &amp;lt;span&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value]&amp;lt;/span&amp;gt;, &amp;lt;span&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute]&amp;lt;/span&amp;gt;, and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
Our Project follows the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[[Observer Pattern]]&amp;lt;/span&amp;gt;, where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality. &lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107631</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107631"/>
		<updated>2017-03-31T03:23:32Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Project Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The DOM standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Tracking issue'''==&lt;br /&gt;
The Original Tracking Issue for the project can be found at the [https://github.com/servo/servo/issues/6633 Tracking Issue] page of the [https://github.com/servo/servo/wiki/Mutation-observer-project Mutation Observer Project].&lt;br /&gt;
&lt;br /&gt;
=='''Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the [https://github.com/srivassumit/servo/wiki/Readme Read me] file of the project Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
'''Initial steps for Stub method Implementation''':&lt;br /&gt;
*Forked the original (Servo)[https://github.com/servo/servo] repository into our GitHub account and created a new Branch (MutationObserver-dev)[https://github.com/srivassumit/servo/tree/MutationObserver-dev] for pushing our changes.&lt;br /&gt;
**Created the [https://dom.spec.whatwg.org/#mutationobserver MutationObserver] and [https://dom.spec.whatwg.org/#mutationrecord MutationRecord] interfaces with stub method implementations following the guidelines given here: [http://doc.servo.org/script/dom/index.html#adding-a-new-dom-interface Adding a new DOM Interface]&lt;br /&gt;
***The IDL Files describe the Structure of the Mutation Observer and Mutation Record classes:&lt;br /&gt;
    '''MutationObserver IDL'''&lt;br /&gt;
    [Constructor(MutationCallback callback)]&lt;br /&gt;
    interface MutationObserver {&lt;br /&gt;
      void observe(Node target, optional MutationObserverInit options);&lt;br /&gt;
      void disconnect();&lt;br /&gt;
      sequence&amp;lt;MutationRecord&amp;gt; takeRecords();&lt;br /&gt;
    };&lt;br /&gt;
    &lt;br /&gt;
    callback MutationCallback  = void (sequence&amp;lt;MutationRecord&amp;gt; mutations, MutationObserver observer);&lt;br /&gt;
    &lt;br /&gt;
    dictionary MutationObserverInit {&lt;br /&gt;
      boolean childList = false;&lt;br /&gt;
      boolean attributes;&lt;br /&gt;
      boolean characterData;&lt;br /&gt;
      boolean subtree = false;&lt;br /&gt;
      boolean attributeOldValue;&lt;br /&gt;
      boolean characterDataOldValue;&lt;br /&gt;
      sequence&amp;lt;DOMString&amp;gt; attributeFilter;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    '''MutationRecord IDL'''&lt;br /&gt;
    [Exposed=Window]&lt;br /&gt;
    interface MutationRecord {&lt;br /&gt;
      readonly attribute DOMString type;&lt;br /&gt;
      [SameObject] readonly attribute Node target;&lt;br /&gt;
      [SameObject] readonly attribute NodeList addedNodes;&lt;br /&gt;
      [SameObject] readonly attribute NodeList removedNodes;&lt;br /&gt;
      readonly attribute Node? previousSibling;&lt;br /&gt;
      readonly attribute Node? nextSibling;&lt;br /&gt;
      readonly attribute DOMString? attributeName;&lt;br /&gt;
      readonly attribute DOMString? attributeNamespace;&lt;br /&gt;
      readonly attribute DOMString? oldValue;&lt;br /&gt;
    };&lt;br /&gt;
*** Added the new interfaces in the dom scripts folder:&lt;br /&gt;
    '''components/script/dom/mutationobserver.rs'''&lt;br /&gt;
    use core::ptr::null;&lt;br /&gt;
    use dom_struct::dom_struct;&lt;br /&gt;
    use dom::bindings::codegen::Bindings::MutationObserverBinding::MutationObserverBinding::MutationObserverMethods;&lt;br /&gt;
    use dom::bindings::codegen::Bindings::MutationObserverBinding::MutationObserverInit;&lt;br /&gt;
    use dom::bindings::js::Root;&lt;br /&gt;
    use dom::bindings::reflector::Reflector;&lt;br /&gt;
    use dom::mutationrecord::MutationRecord;&lt;br /&gt;
    use dom::node::Node;&lt;br /&gt;
    &lt;br /&gt;
    #[dom_struct]&lt;br /&gt;
    pub struct MutationObserver {&lt;br /&gt;
      reflector_: Reflector,&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationObserver {&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationObserverMethods for MutationObserver {&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    '''components/script/dom/mutationrecord.rs'''&lt;br /&gt;
    use core::ptr::null;&lt;br /&gt;
    use dom_struct::dom_struct;&lt;br /&gt;
    use dom::bindings::codegen::Bindings::MutationRecordBinding::MutationRecordBinding::MutationRecordMethods;&lt;br /&gt;
    use dom::bindings::js::{JS, Root};&lt;br /&gt;
    use dom::bindings::str::DOMString;&lt;br /&gt;
    use dom::bindings::reflector::Reflector;&lt;br /&gt;
    use dom::node::Node;&lt;br /&gt;
    use dom::nodelist::NodeList;&lt;br /&gt;
    use dom::window::Window;&lt;br /&gt;
    &lt;br /&gt;
    #[dom_struct]&lt;br /&gt;
    pub struct MutationRecord {&lt;br /&gt;
      reflector_: Reflector,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString record_type;&lt;br /&gt;
      record_type: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute Node target;&lt;br /&gt;
      target: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute NodeList addedNodes;&lt;br /&gt;
      addedNodes: Root&amp;lt;NodeList&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute NodeList removedNodes;&lt;br /&gt;
      removedNodes: Root&amp;lt;NodeList&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute Node? previousSibling;&lt;br /&gt;
      previousSibling: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute Node? nextSibling;&lt;br /&gt;
      nextSibling: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString? attributeName;&lt;br /&gt;
      attributeName: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString? attributeNamespace;&lt;br /&gt;
      attributeNamespace: DOMString,&lt;br /&gt;
    &lt;br /&gt;
   //  readonly attribute DOMString? oldValue;&lt;br /&gt;
      oldValue: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationRecord {&lt;br /&gt;
        fn new(window: &amp;amp;Window, record_type: DOMString, target: Root&amp;lt;Node&amp;gt;) -&amp;gt; Root&amp;lt;MutationRecord&amp;gt; {&lt;br /&gt;
            MutationRecord {&lt;br /&gt;
                reflector_: Reflector::new(),&lt;br /&gt;
                record_type: record_type,&lt;br /&gt;
                target: target,&lt;br /&gt;
                addedNodes: NodeList::empty(window),&lt;br /&gt;
                removedNodes: NodeList::empty(window),&lt;br /&gt;
                previousSibling: None,&lt;br /&gt;
                nextSibling: None,&lt;br /&gt;
                attributeName: None,&lt;br /&gt;
                attributeNamespace: None,&lt;br /&gt;
                oldValue: None,&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationRecordMethods for MutationRecord {&lt;br /&gt;
    &lt;br /&gt;
      fn Type(&amp;amp;self) -&amp;gt; DOMString {&lt;br /&gt;
          return self.record_type;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn Target(&amp;amp;self) -&amp;gt; Root&amp;lt;Node&amp;gt; {&lt;br /&gt;
          return self.target;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn AddedNodes(&amp;amp;self) -&amp;gt; Root&amp;lt;NodeList&amp;gt; {&lt;br /&gt;
          return self.addedNodes;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn RemovedNodes(&amp;amp;self) -&amp;gt; Root&amp;lt;NodeList&amp;gt; {&lt;br /&gt;
          return self.removedNodes;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetPreviousSibling(&amp;amp;self) -&amp;gt; Option&amp;lt;Root&amp;lt;Node&amp;gt;&amp;gt; {&lt;br /&gt;
          if self.previousSibling.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.previousSibling);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetNextSibling(&amp;amp;self) -&amp;gt; Option&amp;lt;Root&amp;lt;Node&amp;gt;&amp;gt; {&lt;br /&gt;
          if self.nextSibling.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.nextSibling);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetAttributeName(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
          if self.attributeName.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.attributeName);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetAttributeNamespace(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
          if self.attributeNamespace.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.attributeNamespace);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetOldValue(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
          if self.oldValue.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.oldValue);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
    } &lt;br /&gt;
***Added the new Interfeces in the &amp;lt;code&amp;gt;mod.rs&amp;lt;/code&amp;gt; file:&lt;br /&gt;
    '''components/script/dom/mod.rs'''&lt;br /&gt;
    ...&lt;br /&gt;
    pub mod mutationobserver;&lt;br /&gt;
    pub mod mutationrecord;&lt;br /&gt;
    ...&lt;br /&gt;
***Added the new Interface bindings in the file:&lt;br /&gt;
    '''components/script/dom/bindings/codegen/Bindings.conf'''&lt;br /&gt;
    ...&lt;br /&gt;
    DOMInterfaces = {&lt;br /&gt;
    ...&lt;br /&gt;
    'MutationObserver': {&lt;br /&gt;
      'nativeType': 'MutationObserver',&lt;br /&gt;
      'path': 'dom::mutationobserver::MutationObserver',&lt;br /&gt;
    },&lt;br /&gt;
    &lt;br /&gt;
    'MutationRecord': {&lt;br /&gt;
      'nativeType': 'MutationRecord',&lt;br /&gt;
      'path': 'dom::mutationrecord::MutationRecord',&lt;br /&gt;
    },&lt;br /&gt;
    ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
**We hid the new interfaces by default by adding a &amp;lt;code&amp;gt;[Pref=&amp;quot;dom.mutation_observer.enabled&amp;quot;]&amp;lt;/code&amp;gt; attribute to both &amp;lt;code&amp;gt;mutationobserver.rs&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mutationrecord.rs&amp;lt;/code&amp;gt; and added a corresponding preference to &amp;lt;code&amp;gt;resources/prefs.json&amp;lt;/code&amp;gt; file.&lt;br /&gt;
    '''resources/prefs.json'''&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;quot;dom.mutation_observer.enabled&amp;quot;: false,&lt;br /&gt;
    ...&lt;br /&gt;
*We added a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects as a member of the [https://github.com/servo/servo/blob/3c8daca772aacf59bffdff32b017f8029437a85e/components/script/script_thread.rs#L397 ScriptThread] as mentioed in the requirements.&lt;br /&gt;
    '''components/script/script_thread.rs'''&lt;br /&gt;
    ...&lt;br /&gt;
    pub struct ScriptThread {&lt;br /&gt;
      ...&lt;br /&gt;
      /// a vector of MutationObserver objects&lt;br /&gt;
      mutation_observers: Vec&amp;lt;MutationObserver&amp;gt;,&lt;br /&gt;
      ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
    impl ScriptThread {&lt;br /&gt;
      ...&lt;br /&gt;
      mutation_observers: vec![],&lt;br /&gt;
      ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
*Implemented the &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; constructor, by following the steps given in the [https://dom.spec.whatwg.org/#dom-mutationobserver-mutationobserver DOM Specifications].&lt;br /&gt;
    '''components/script/dom/mutationobserver.rs'''&lt;br /&gt;
    ...&lt;br /&gt;
    pub fn Constructor(global: &amp;amp;GlobalScope, callback: Rc&amp;lt;MutationCallback&amp;gt;) -&amp;gt; Result&amp;lt;Root&amp;lt;MutationObserver&amp;gt;, Error&amp;gt; {&lt;br /&gt;
      callback = &amp;amp;callback&lt;br /&gt;
      let mut frameBrowsingContext = Frames(&amp;amp;self)&lt;br /&gt;
      &lt;br /&gt;
      Ok(MutationObserver::new(global,this.callback)),&lt;br /&gt;
      Err(Error::new())&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
Since the tests were already present in the original Servo repository,Only the test expectation were needed to be updated. We did that as mentioned in the project description in the following steps:&lt;br /&gt;
&lt;br /&gt;
*Added a &amp;lt;code&amp;gt;__dir__.ini &amp;lt;/code&amp;gt; file to &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; for enabling the new preference by including &amp;lt;code&amp;gt;&amp;quot;prefs: [&amp;quot;dom.mutation_observer.enabled:true&amp;quot;]&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
    '''tests/wpt/metadata/dom/nodes/__dir__.ini'''&lt;br /&gt;
    prefs: [&amp;quot;dom.mutation_observer.enabled:true&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
*Tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
*The web-platform tests can be run by giving the following command at the root directory of the project:&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
*We have Updated the corresponding test expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in the &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
Our Project follows the [https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern], where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
After making the above mentioned changes, we can create the Mutation Observer Object using the Constructor which we have implemented.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Subsequent Steps'''==&lt;br /&gt;
After completing the above initial steps, we plan on performing the following tasks:&lt;br /&gt;
&lt;br /&gt;
*add support for mutation observer microtasks&lt;br /&gt;
**add a mutation_observer_compound_microtask_queued member to ScriptThread&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask] algorithm by adding a new variant to the [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask] enum for mutation observers&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers] algorithm (ignoring the specific text about &amp;quot;execute a compound microtask&amp;quot;) using the vector of observers previously added to ScriptThread&lt;br /&gt;
*add support for observing specific mutations&lt;br /&gt;
**add a vector of MutationObserver objects to Node&lt;br /&gt;
**implement [https://dom.spec.whatwg.org/#dom-mutationobserver-observe MutationObserver.observe] (step 7 and 8 mean &amp;quot;replace an existing matching entry with the new options, or add a new entry if there is no match&amp;quot;)&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record] algorithm&lt;br /&gt;
**make [https://dom.spec.whatwg.org/#concept-element-attributes-change changing]/[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]/[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]/[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing] an attribute queue a mutation record via [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value], [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute], and [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&lt;br /&gt;
&lt;br /&gt;
=='''Commit Frequency'''==&lt;br /&gt;
As per the guidelines of the Mozilla project, all the changes will be submitted in a single commit.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107627</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107627"/>
		<updated>2017-03-31T02:53:26Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Testing */ added reason for not having a separate test plan&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The DOM standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Tracking issue'''==&lt;br /&gt;
The Original Tracking Issue for the project can be found at the [https://github.com/servo/servo/issues/6633 Tracking Issue] page of the [https://github.com/servo/servo/wiki/Mutation-observer-project Mutation Observer Project].&lt;br /&gt;
&lt;br /&gt;
=='''Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the [https://github.com/srivassumit/servo/wiki/Readme Read me] file of the project Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
'''Initial steps for Stub method Implementation''':&lt;br /&gt;
*Forked the original (Servo)[https://github.com/servo/servo] repository into our GitHub account and created a new Branch (MutationObserver-dev)[https://github.com/srivassumit/servo/tree/MutationObserver-dev] for pushing our changes.&lt;br /&gt;
**Created the [https://dom.spec.whatwg.org/#mutationobserver MutationObserver] and [https://dom.spec.whatwg.org/#mutationrecord MutationRecord] interfaces with stub method implementations following the guidelines given here: [http://doc.servo.org/script/dom/index.html#adding-a-new-dom-interface Adding a new DOM Interface]&lt;br /&gt;
***The IDL Files describe the Structure of the Mutation Observer and Mutation Record classes:&lt;br /&gt;
    '''MutationObserver IDL'''&lt;br /&gt;
    [Constructor(MutationCallback callback)]&lt;br /&gt;
    interface MutationObserver {&lt;br /&gt;
      void observe(Node target, optional MutationObserverInit options);&lt;br /&gt;
      void disconnect();&lt;br /&gt;
      sequence&amp;lt;MutationRecord&amp;gt; takeRecords();&lt;br /&gt;
    };&lt;br /&gt;
    &lt;br /&gt;
    callback MutationCallback  = void (sequence&amp;lt;MutationRecord&amp;gt; mutations, MutationObserver observer);&lt;br /&gt;
    &lt;br /&gt;
    dictionary MutationObserverInit {&lt;br /&gt;
      boolean childList = false;&lt;br /&gt;
      boolean attributes;&lt;br /&gt;
      boolean characterData;&lt;br /&gt;
      boolean subtree = false;&lt;br /&gt;
      boolean attributeOldValue;&lt;br /&gt;
      boolean characterDataOldValue;&lt;br /&gt;
      sequence&amp;lt;DOMString&amp;gt; attributeFilter;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    '''MutationRecord IDL'''&lt;br /&gt;
    [Exposed=Window]&lt;br /&gt;
    interface MutationRecord {&lt;br /&gt;
      readonly attribute DOMString type;&lt;br /&gt;
      [SameObject] readonly attribute Node target;&lt;br /&gt;
      [SameObject] readonly attribute NodeList addedNodes;&lt;br /&gt;
      [SameObject] readonly attribute NodeList removedNodes;&lt;br /&gt;
      readonly attribute Node? previousSibling;&lt;br /&gt;
      readonly attribute Node? nextSibling;&lt;br /&gt;
      readonly attribute DOMString? attributeName;&lt;br /&gt;
      readonly attribute DOMString? attributeNamespace;&lt;br /&gt;
      readonly attribute DOMString? oldValue;&lt;br /&gt;
    };&lt;br /&gt;
*** Added the new interfaces in the dom scripts folder:&lt;br /&gt;
    '''components/script/dom/mutationobserver.rs'''&lt;br /&gt;
    use core::ptr::null;&lt;br /&gt;
    use dom_struct::dom_struct;&lt;br /&gt;
    use dom::bindings::codegen::Bindings::MutationObserverBinding::MutationObserverBinding::MutationObserverMethods;&lt;br /&gt;
    use dom::bindings::codegen::Bindings::MutationObserverBinding::MutationObserverInit;&lt;br /&gt;
    use dom::bindings::js::Root;&lt;br /&gt;
    use dom::bindings::reflector::Reflector;&lt;br /&gt;
    use dom::mutationrecord::MutationRecord;&lt;br /&gt;
    use dom::node::Node;&lt;br /&gt;
    &lt;br /&gt;
    #[dom_struct]&lt;br /&gt;
    pub struct MutationObserver {&lt;br /&gt;
      reflector_: Reflector,&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationObserver {&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationObserverMethods for MutationObserver {&lt;br /&gt;
    &lt;br /&gt;
      //void observe(Node target, optional MutationObserverInit options);&lt;br /&gt;
      fn Observe(&amp;amp;self, target: &amp;amp;Node, options: &amp;amp;MutationObserverInit) {&lt;br /&gt;
    	// TODO implement&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
      //void disconnect();&lt;br /&gt;
      fn Disconnect(&amp;amp;self) {&lt;br /&gt;
    	// TODO implement&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      //sequence&amp;lt;MutationRecord&amp;gt; takeRecords();&lt;br /&gt;
      fn TakeRecords(&amp;amp;self) -&amp;gt; Vec&amp;lt;Root&amp;lt;MutationRecord&amp;gt;&amp;gt; {&lt;br /&gt;
          return vec![];&lt;br /&gt;
    	//TODO implement&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
    '''components/script/dom/mutationrecord.rs'''&lt;br /&gt;
    use core::ptr::null;&lt;br /&gt;
    use dom_struct::dom_struct;&lt;br /&gt;
    use dom::bindings::codegen::Bindings::MutationRecordBinding::MutationRecordBinding::MutationRecordMethods;&lt;br /&gt;
    use dom::bindings::js::{JS, Root};&lt;br /&gt;
    use dom::bindings::str::DOMString;&lt;br /&gt;
    use dom::bindings::reflector::Reflector;&lt;br /&gt;
    use dom::node::Node;&lt;br /&gt;
    use dom::nodelist::NodeList;&lt;br /&gt;
    use dom::window::Window;&lt;br /&gt;
    &lt;br /&gt;
    #[dom_struct]&lt;br /&gt;
    pub struct MutationRecord {&lt;br /&gt;
      reflector_: Reflector,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString record_type;&lt;br /&gt;
      record_type: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute Node target;&lt;br /&gt;
      target: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute NodeList addedNodes;&lt;br /&gt;
      addedNodes: Root&amp;lt;NodeList&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute NodeList removedNodes;&lt;br /&gt;
      removedNodes: Root&amp;lt;NodeList&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute Node? previousSibling;&lt;br /&gt;
      previousSibling: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute Node? nextSibling;&lt;br /&gt;
      nextSibling: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString? attributeName;&lt;br /&gt;
      attributeName: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString? attributeNamespace;&lt;br /&gt;
      attributeNamespace: DOMString,&lt;br /&gt;
    &lt;br /&gt;
   //  readonly attribute DOMString? oldValue;&lt;br /&gt;
      oldValue: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationRecord {&lt;br /&gt;
        fn new(window: &amp;amp;Window, record_type: DOMString, target: Root&amp;lt;Node&amp;gt;) -&amp;gt; Root&amp;lt;MutationRecord&amp;gt; {&lt;br /&gt;
            MutationRecord {&lt;br /&gt;
                reflector_: Reflector::new(),&lt;br /&gt;
                record_type: record_type,&lt;br /&gt;
                target: target,&lt;br /&gt;
                addedNodes: NodeList::empty(window),&lt;br /&gt;
                removedNodes: NodeList::empty(window),&lt;br /&gt;
                previousSibling: None,&lt;br /&gt;
                nextSibling: None,&lt;br /&gt;
                attributeName: None,&lt;br /&gt;
                attributeNamespace: None,&lt;br /&gt;
                oldValue: None,&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationRecordMethods for MutationRecord {&lt;br /&gt;
    &lt;br /&gt;
      fn Type(&amp;amp;self) -&amp;gt; DOMString {&lt;br /&gt;
          return self.record_type;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn Target(&amp;amp;self) -&amp;gt; Root&amp;lt;Node&amp;gt; {&lt;br /&gt;
          return self.target;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn AddedNodes(&amp;amp;self) -&amp;gt; Root&amp;lt;NodeList&amp;gt; {&lt;br /&gt;
          return self.addedNodes;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn RemovedNodes(&amp;amp;self) -&amp;gt; Root&amp;lt;NodeList&amp;gt; {&lt;br /&gt;
          return self.removedNodes;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetPreviousSibling(&amp;amp;self) -&amp;gt; Option&amp;lt;Root&amp;lt;Node&amp;gt;&amp;gt; {&lt;br /&gt;
          if self.previousSibling.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.previousSibling);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetNextSibling(&amp;amp;self) -&amp;gt; Option&amp;lt;Root&amp;lt;Node&amp;gt;&amp;gt; {&lt;br /&gt;
          if self.nextSibling.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.nextSibling);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetAttributeName(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
          if self.attributeName.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.attributeName);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetAttributeNamespace(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
          if self.attributeNamespace.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.attributeNamespace);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetOldValue(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
          if self.oldValue.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.oldValue);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
    } &lt;br /&gt;
***Added the new Interfeces in the &amp;lt;code&amp;gt;mod.rs&amp;lt;/code&amp;gt; file:&lt;br /&gt;
    '''components/script/dom/mod.rs'''&lt;br /&gt;
    ...&lt;br /&gt;
    pub mod mutationobserver;&lt;br /&gt;
    pub mod mutationrecord;&lt;br /&gt;
    ...&lt;br /&gt;
***Added the new Interface bindings in the file:&lt;br /&gt;
    '''components/script/dom/bindings/codegen/Bindings.conf'''&lt;br /&gt;
    ...&lt;br /&gt;
    DOMInterfaces = {&lt;br /&gt;
    ...&lt;br /&gt;
    'MutationObserver': {&lt;br /&gt;
      'nativeType': 'MutationObserver',&lt;br /&gt;
      'path': 'dom::mutationobserver::MutationObserver',&lt;br /&gt;
    },&lt;br /&gt;
    &lt;br /&gt;
    'MutationRecord': {&lt;br /&gt;
      'nativeType': 'MutationRecord',&lt;br /&gt;
      'path': 'dom::mutationrecord::MutationRecord',&lt;br /&gt;
    },&lt;br /&gt;
    ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
**We hid the new interfaces by default by adding a &amp;lt;code&amp;gt;[Pref=&amp;quot;dom.mutation_observer.enabled&amp;quot;]&amp;lt;/code&amp;gt; attribute to both &amp;lt;code&amp;gt;mutationobserver.rs&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mutationrecord.rs&amp;lt;/code&amp;gt; and added a corresponding preference to &amp;lt;code&amp;gt;resources/prefs.json&amp;lt;/code&amp;gt; file.&lt;br /&gt;
    '''resources/prefs.json'''&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;quot;dom.mutation_observer.enabled&amp;quot;: false,&lt;br /&gt;
    ...&lt;br /&gt;
*We added a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects as a member of the [https://github.com/servo/servo/blob/3c8daca772aacf59bffdff32b017f8029437a85e/components/script/script_thread.rs#L397 ScriptThread] as mentioed in the requirements.&lt;br /&gt;
    '''components/script/script_thread.rs'''&lt;br /&gt;
    ...&lt;br /&gt;
    pub struct ScriptThread {&lt;br /&gt;
      ...&lt;br /&gt;
      /// a vector of MutationObserver objects&lt;br /&gt;
      mutation_observers: Vec&amp;lt;MutationObserver&amp;gt;,&lt;br /&gt;
      ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
    impl ScriptThread {&lt;br /&gt;
      ...&lt;br /&gt;
      mutation_observers: vec![],&lt;br /&gt;
      ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
*Implemented the &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; constructor, by following the steps given in the [https://dom.spec.whatwg.org/#dom-mutationobserver-mutationobserver DOM Specifications].&lt;br /&gt;
    '''components/script/dom/mutationobserver.rs'''&lt;br /&gt;
    ...&lt;br /&gt;
    pub fn Constructor(global: &amp;amp;GlobalScope, callback: Rc&amp;lt;MutationCallback&amp;gt;) -&amp;gt; Result&amp;lt;Root&amp;lt;MutationObserver&amp;gt;, Error&amp;gt; {&lt;br /&gt;
      callback = &amp;amp;callback&lt;br /&gt;
      let mut frameBrowsingContext = Frames(&amp;amp;self)&lt;br /&gt;
      &lt;br /&gt;
      Ok(MutationObserver::new(global,this.callback)),&lt;br /&gt;
      Err(Error::new())&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
Since the tests were already present in the original Servo repository,Only the test expectation were needed to be updated. We did that as mentioned in the project description in the following steps:&lt;br /&gt;
&lt;br /&gt;
*Added a &amp;lt;code&amp;gt;__dir__.ini &amp;lt;/code&amp;gt; file to &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; for enabling the new preference by including &amp;lt;code&amp;gt;&amp;quot;prefs: [&amp;quot;dom.mutation_observer.enabled:true&amp;quot;]&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
    '''tests/wpt/metadata/dom/nodes/__dir__.ini'''&lt;br /&gt;
    prefs: [&amp;quot;dom.mutation_observer.enabled:true&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
*Tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
*The web-platform tests can be run by giving the following command at the root directory of the project:&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
*We have Updated the corresponding test expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in the &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
Our Project follows the [https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern], where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
After making the above mentioned changes, we can create the Mutation Observer Object using the Constructor which we have implemented.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Subsequent Steps'''==&lt;br /&gt;
After completing the above initial steps, we plan on performing the following tasks:&lt;br /&gt;
&lt;br /&gt;
*add support for mutation observer microtasks&lt;br /&gt;
**add a mutation_observer_compound_microtask_queued member to ScriptThread&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask] algorithm by adding a new variant to the [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask] enum for mutation observers&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers] algorithm (ignoring the specific text about &amp;quot;execute a compound microtask&amp;quot;) using the vector of observers previously added to ScriptThread&lt;br /&gt;
*add support for observing specific mutations&lt;br /&gt;
**add a vector of MutationObserver objects to Node&lt;br /&gt;
**implement [https://dom.spec.whatwg.org/#dom-mutationobserver-observe MutationObserver.observe] (step 7 and 8 mean &amp;quot;replace an existing matching entry with the new options, or add a new entry if there is no match&amp;quot;)&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record] algorithm&lt;br /&gt;
**make [https://dom.spec.whatwg.org/#concept-element-attributes-change changing]/[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]/[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]/[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing] an attribute queue a mutation record via [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value], [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute], and [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&lt;br /&gt;
&lt;br /&gt;
=='''Commit Frequency'''==&lt;br /&gt;
As per the guidelines of the Mozilla project, all the changes will be submitted in a single commit.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107626</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107626"/>
		<updated>2017-03-31T02:49:32Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Project Description */ changes as per the review comments.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The DOM standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Tracking issue'''==&lt;br /&gt;
The Original Tracking Issue for the project can be found at the [https://github.com/servo/servo/issues/6633 Tracking Issue] page of the [https://github.com/servo/servo/wiki/Mutation-observer-project Mutation Observer Project].&lt;br /&gt;
&lt;br /&gt;
=='''Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the [https://github.com/srivassumit/servo/wiki/Readme Read me] file of the project Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
'''Initial steps for Stub method Implementation''':&lt;br /&gt;
*Forked the original (Servo)[https://github.com/servo/servo] repository into our GitHub account and created a new Branch (MutationObserver-dev)[https://github.com/srivassumit/servo/tree/MutationObserver-dev] for pushing our changes.&lt;br /&gt;
**Created the [https://dom.spec.whatwg.org/#mutationobserver MutationObserver] and [https://dom.spec.whatwg.org/#mutationrecord MutationRecord] interfaces with stub method implementations following the guidelines given here: [http://doc.servo.org/script/dom/index.html#adding-a-new-dom-interface Adding a new DOM Interface]&lt;br /&gt;
***The IDL Files describe the Structure of the Mutation Observer and Mutation Record classes:&lt;br /&gt;
    '''MutationObserver IDL'''&lt;br /&gt;
    [Constructor(MutationCallback callback)]&lt;br /&gt;
    interface MutationObserver {&lt;br /&gt;
      void observe(Node target, optional MutationObserverInit options);&lt;br /&gt;
      void disconnect();&lt;br /&gt;
      sequence&amp;lt;MutationRecord&amp;gt; takeRecords();&lt;br /&gt;
    };&lt;br /&gt;
    &lt;br /&gt;
    callback MutationCallback  = void (sequence&amp;lt;MutationRecord&amp;gt; mutations, MutationObserver observer);&lt;br /&gt;
    &lt;br /&gt;
    dictionary MutationObserverInit {&lt;br /&gt;
      boolean childList = false;&lt;br /&gt;
      boolean attributes;&lt;br /&gt;
      boolean characterData;&lt;br /&gt;
      boolean subtree = false;&lt;br /&gt;
      boolean attributeOldValue;&lt;br /&gt;
      boolean characterDataOldValue;&lt;br /&gt;
      sequence&amp;lt;DOMString&amp;gt; attributeFilter;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    '''MutationRecord IDL'''&lt;br /&gt;
    [Exposed=Window]&lt;br /&gt;
    interface MutationRecord {&lt;br /&gt;
      readonly attribute DOMString type;&lt;br /&gt;
      [SameObject] readonly attribute Node target;&lt;br /&gt;
      [SameObject] readonly attribute NodeList addedNodes;&lt;br /&gt;
      [SameObject] readonly attribute NodeList removedNodes;&lt;br /&gt;
      readonly attribute Node? previousSibling;&lt;br /&gt;
      readonly attribute Node? nextSibling;&lt;br /&gt;
      readonly attribute DOMString? attributeName;&lt;br /&gt;
      readonly attribute DOMString? attributeNamespace;&lt;br /&gt;
      readonly attribute DOMString? oldValue;&lt;br /&gt;
    };&lt;br /&gt;
*** Added the new interfaces in the dom scripts folder:&lt;br /&gt;
    '''components/script/dom/mutationobserver.rs'''&lt;br /&gt;
    use core::ptr::null;&lt;br /&gt;
    use dom_struct::dom_struct;&lt;br /&gt;
    use dom::bindings::codegen::Bindings::MutationObserverBinding::MutationObserverBinding::MutationObserverMethods;&lt;br /&gt;
    use dom::bindings::codegen::Bindings::MutationObserverBinding::MutationObserverInit;&lt;br /&gt;
    use dom::bindings::js::Root;&lt;br /&gt;
    use dom::bindings::reflector::Reflector;&lt;br /&gt;
    use dom::mutationrecord::MutationRecord;&lt;br /&gt;
    use dom::node::Node;&lt;br /&gt;
    &lt;br /&gt;
    #[dom_struct]&lt;br /&gt;
    pub struct MutationObserver {&lt;br /&gt;
      reflector_: Reflector,&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationObserver {&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationObserverMethods for MutationObserver {&lt;br /&gt;
    &lt;br /&gt;
      //void observe(Node target, optional MutationObserverInit options);&lt;br /&gt;
      fn Observe(&amp;amp;self, target: &amp;amp;Node, options: &amp;amp;MutationObserverInit) {&lt;br /&gt;
    	// TODO implement&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
      //void disconnect();&lt;br /&gt;
      fn Disconnect(&amp;amp;self) {&lt;br /&gt;
    	// TODO implement&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      //sequence&amp;lt;MutationRecord&amp;gt; takeRecords();&lt;br /&gt;
      fn TakeRecords(&amp;amp;self) -&amp;gt; Vec&amp;lt;Root&amp;lt;MutationRecord&amp;gt;&amp;gt; {&lt;br /&gt;
          return vec![];&lt;br /&gt;
    	//TODO implement&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
    '''components/script/dom/mutationrecord.rs'''&lt;br /&gt;
    use core::ptr::null;&lt;br /&gt;
    use dom_struct::dom_struct;&lt;br /&gt;
    use dom::bindings::codegen::Bindings::MutationRecordBinding::MutationRecordBinding::MutationRecordMethods;&lt;br /&gt;
    use dom::bindings::js::{JS, Root};&lt;br /&gt;
    use dom::bindings::str::DOMString;&lt;br /&gt;
    use dom::bindings::reflector::Reflector;&lt;br /&gt;
    use dom::node::Node;&lt;br /&gt;
    use dom::nodelist::NodeList;&lt;br /&gt;
    use dom::window::Window;&lt;br /&gt;
    &lt;br /&gt;
    #[dom_struct]&lt;br /&gt;
    pub struct MutationRecord {&lt;br /&gt;
      reflector_: Reflector,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString record_type;&lt;br /&gt;
      record_type: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute Node target;&lt;br /&gt;
      target: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute NodeList addedNodes;&lt;br /&gt;
      addedNodes: Root&amp;lt;NodeList&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute NodeList removedNodes;&lt;br /&gt;
      removedNodes: Root&amp;lt;NodeList&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute Node? previousSibling;&lt;br /&gt;
      previousSibling: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute Node? nextSibling;&lt;br /&gt;
      nextSibling: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString? attributeName;&lt;br /&gt;
      attributeName: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString? attributeNamespace;&lt;br /&gt;
      attributeNamespace: DOMString,&lt;br /&gt;
    &lt;br /&gt;
   //  readonly attribute DOMString? oldValue;&lt;br /&gt;
      oldValue: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationRecord {&lt;br /&gt;
        fn new(window: &amp;amp;Window, record_type: DOMString, target: Root&amp;lt;Node&amp;gt;) -&amp;gt; Root&amp;lt;MutationRecord&amp;gt; {&lt;br /&gt;
            MutationRecord {&lt;br /&gt;
                reflector_: Reflector::new(),&lt;br /&gt;
                record_type: record_type,&lt;br /&gt;
                target: target,&lt;br /&gt;
                addedNodes: NodeList::empty(window),&lt;br /&gt;
                removedNodes: NodeList::empty(window),&lt;br /&gt;
                previousSibling: None,&lt;br /&gt;
                nextSibling: None,&lt;br /&gt;
                attributeName: None,&lt;br /&gt;
                attributeNamespace: None,&lt;br /&gt;
                oldValue: None,&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationRecordMethods for MutationRecord {&lt;br /&gt;
    &lt;br /&gt;
      fn Type(&amp;amp;self) -&amp;gt; DOMString {&lt;br /&gt;
          return self.record_type;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn Target(&amp;amp;self) -&amp;gt; Root&amp;lt;Node&amp;gt; {&lt;br /&gt;
          return self.target;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn AddedNodes(&amp;amp;self) -&amp;gt; Root&amp;lt;NodeList&amp;gt; {&lt;br /&gt;
          return self.addedNodes;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn RemovedNodes(&amp;amp;self) -&amp;gt; Root&amp;lt;NodeList&amp;gt; {&lt;br /&gt;
          return self.removedNodes;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetPreviousSibling(&amp;amp;self) -&amp;gt; Option&amp;lt;Root&amp;lt;Node&amp;gt;&amp;gt; {&lt;br /&gt;
          if self.previousSibling.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.previousSibling);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetNextSibling(&amp;amp;self) -&amp;gt; Option&amp;lt;Root&amp;lt;Node&amp;gt;&amp;gt; {&lt;br /&gt;
          if self.nextSibling.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.nextSibling);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetAttributeName(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
          if self.attributeName.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.attributeName);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetAttributeNamespace(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
          if self.attributeNamespace.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.attributeNamespace);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetOldValue(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
          if self.oldValue.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.oldValue);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
    } &lt;br /&gt;
***Added the new Interfeces in the &amp;lt;code&amp;gt;mod.rs&amp;lt;/code&amp;gt; file:&lt;br /&gt;
    '''components/script/dom/mod.rs'''&lt;br /&gt;
    ...&lt;br /&gt;
    pub mod mutationobserver;&lt;br /&gt;
    pub mod mutationrecord;&lt;br /&gt;
    ...&lt;br /&gt;
***Added the new Interface bindings in the file:&lt;br /&gt;
    '''components/script/dom/bindings/codegen/Bindings.conf'''&lt;br /&gt;
    ...&lt;br /&gt;
    DOMInterfaces = {&lt;br /&gt;
    ...&lt;br /&gt;
    'MutationObserver': {&lt;br /&gt;
      'nativeType': 'MutationObserver',&lt;br /&gt;
      'path': 'dom::mutationobserver::MutationObserver',&lt;br /&gt;
    },&lt;br /&gt;
    &lt;br /&gt;
    'MutationRecord': {&lt;br /&gt;
      'nativeType': 'MutationRecord',&lt;br /&gt;
      'path': 'dom::mutationrecord::MutationRecord',&lt;br /&gt;
    },&lt;br /&gt;
    ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
**We hid the new interfaces by default by adding a &amp;lt;code&amp;gt;[Pref=&amp;quot;dom.mutation_observer.enabled&amp;quot;]&amp;lt;/code&amp;gt; attribute to both &amp;lt;code&amp;gt;mutationobserver.rs&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mutationrecord.rs&amp;lt;/code&amp;gt; and added a corresponding preference to &amp;lt;code&amp;gt;resources/prefs.json&amp;lt;/code&amp;gt; file.&lt;br /&gt;
    '''resources/prefs.json'''&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;quot;dom.mutation_observer.enabled&amp;quot;: false,&lt;br /&gt;
    ...&lt;br /&gt;
*We added a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects as a member of the [https://github.com/servo/servo/blob/3c8daca772aacf59bffdff32b017f8029437a85e/components/script/script_thread.rs#L397 ScriptThread] as mentioed in the requirements.&lt;br /&gt;
    '''components/script/script_thread.rs'''&lt;br /&gt;
    ...&lt;br /&gt;
    pub struct ScriptThread {&lt;br /&gt;
      ...&lt;br /&gt;
      /// a vector of MutationObserver objects&lt;br /&gt;
      mutation_observers: Vec&amp;lt;MutationObserver&amp;gt;,&lt;br /&gt;
      ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
    impl ScriptThread {&lt;br /&gt;
      ...&lt;br /&gt;
      mutation_observers: vec![],&lt;br /&gt;
      ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
*Implemented the &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; constructor, by following the steps given in the [https://dom.spec.whatwg.org/#dom-mutationobserver-mutationobserver DOM Specifications].&lt;br /&gt;
    '''components/script/dom/mutationobserver.rs'''&lt;br /&gt;
    ...&lt;br /&gt;
    pub fn Constructor(global: &amp;amp;GlobalScope, callback: Rc&amp;lt;MutationCallback&amp;gt;) -&amp;gt; Result&amp;lt;Root&amp;lt;MutationObserver&amp;gt;, Error&amp;gt; {&lt;br /&gt;
      callback = &amp;amp;callback&lt;br /&gt;
      let mut frameBrowsingContext = Frames(&amp;amp;self)&lt;br /&gt;
      &lt;br /&gt;
      Ok(MutationObserver::new(global,this.callback)),&lt;br /&gt;
      Err(Error::new())&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
*Added a &amp;lt;code&amp;gt;__dir__.ini &amp;lt;/code&amp;gt; file to &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; for enabling the new preference by including &amp;lt;code&amp;gt;&amp;quot;prefs: [&amp;quot;dom.mutation_observer.enabled:true&amp;quot;]&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
    '''tests/wpt/metadata/dom/nodes/__dir__.ini'''&lt;br /&gt;
    prefs: [&amp;quot;dom.mutation_observer.enabled:true&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
*Tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
*The web-platform tests can be run by giving the following command at the root directory of the project:&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
*We have Updated the corresponding test expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in the &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
Our Project follows the [https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern], where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
After making the above mentioned changes, we can create the Mutation Observer Object using the Constructor which we have implemented.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Subsequent Steps'''==&lt;br /&gt;
After completing the above initial steps, we plan on performing the following tasks:&lt;br /&gt;
&lt;br /&gt;
*add support for mutation observer microtasks&lt;br /&gt;
**add a mutation_observer_compound_microtask_queued member to ScriptThread&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask] algorithm by adding a new variant to the [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask] enum for mutation observers&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers] algorithm (ignoring the specific text about &amp;quot;execute a compound microtask&amp;quot;) using the vector of observers previously added to ScriptThread&lt;br /&gt;
*add support for observing specific mutations&lt;br /&gt;
**add a vector of MutationObserver objects to Node&lt;br /&gt;
**implement [https://dom.spec.whatwg.org/#dom-mutationobserver-observe MutationObserver.observe] (step 7 and 8 mean &amp;quot;replace an existing matching entry with the new options, or add a new entry if there is no match&amp;quot;)&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record] algorithm&lt;br /&gt;
**make [https://dom.spec.whatwg.org/#concept-element-attributes-change changing]/[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]/[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]/[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing] an attribute queue a mutation record via [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value], [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute], and [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&lt;br /&gt;
&lt;br /&gt;
=='''Commit Frequency'''==&lt;br /&gt;
As per the guidelines of the Mozilla project, all the changes will be submitted in a single commit.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107292</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107292"/>
		<updated>2017-03-23T21:25:04Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Project Description */ correcte the mutationobserver interface&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The DOM standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Tracking issue'''==&lt;br /&gt;
The Original Tracking Issue for the project can be found at the [https://github.com/servo/servo/issues/6633 Tracking Issue] page of the [https://github.com/servo/servo/wiki/Mutation-observer-project Mutation Observer Project].&lt;br /&gt;
&lt;br /&gt;
=='''Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the [https://github.com/srivassumit/servo/wiki/Readme Read me] file of the project Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
*'''Initial steps for Stub method Implementation''':&lt;br /&gt;
**Created the [https://dom.spec.whatwg.org/#mutationobserver MutationObserver] and [https://dom.spec.whatwg.org/#mutationrecord MutationRecord] interfaces with stub method implementations following the guidelines given here: [http://doc.servo.org/script/dom/index.html#adding-a-new-dom-interface Adding a new DOM Interface]&lt;br /&gt;
***The IDL Files describe the Structure of the Mutation Observer and Mutation Record classes:&lt;br /&gt;
    '''MutationObserver IDL'''&lt;br /&gt;
    [Constructor(MutationCallback callback)]&lt;br /&gt;
    interface MutationObserver {&lt;br /&gt;
      void observe(Node target, optional MutationObserverInit options);&lt;br /&gt;
      void disconnect();&lt;br /&gt;
      sequence&amp;lt;MutationRecord&amp;gt; takeRecords();&lt;br /&gt;
    };&lt;br /&gt;
    &lt;br /&gt;
    callback MutationCallback  = void (sequence&amp;lt;MutationRecord&amp;gt; mutations, MutationObserver observer);&lt;br /&gt;
    &lt;br /&gt;
    dictionary MutationObserverInit {&lt;br /&gt;
      boolean childList = false;&lt;br /&gt;
      boolean attributes;&lt;br /&gt;
      boolean characterData;&lt;br /&gt;
      boolean subtree = false;&lt;br /&gt;
      boolean attributeOldValue;&lt;br /&gt;
      boolean characterDataOldValue;&lt;br /&gt;
      sequence&amp;lt;DOMString&amp;gt; attributeFilter;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    '''MutationRecord IDL'''&lt;br /&gt;
    [Exposed=Window]&lt;br /&gt;
    interface MutationRecord {&lt;br /&gt;
      readonly attribute DOMString type;&lt;br /&gt;
      [SameObject] readonly attribute Node target;&lt;br /&gt;
      [SameObject] readonly attribute NodeList addedNodes;&lt;br /&gt;
      [SameObject] readonly attribute NodeList removedNodes;&lt;br /&gt;
      readonly attribute Node? previousSibling;&lt;br /&gt;
      readonly attribute Node? nextSibling;&lt;br /&gt;
      readonly attribute DOMString? attributeName;&lt;br /&gt;
      readonly attribute DOMString? attributeNamespace;&lt;br /&gt;
      readonly attribute DOMString? oldValue;&lt;br /&gt;
    };&lt;br /&gt;
*** Added the new interfaces in the dom scripts folder:&lt;br /&gt;
    '''components/script/dom/mutationobserver.rs'''&lt;br /&gt;
    use core::ptr::null;&lt;br /&gt;
    use dom_struct::dom_struct;&lt;br /&gt;
    use dom::bindings::codegen::Bindings::MutationObserverBinding::MutationObserverBinding::MutationObserverMethods;&lt;br /&gt;
    use dom::bindings::codegen::Bindings::MutationObserverBinding::MutationObserverInit;&lt;br /&gt;
    use dom::bindings::js::Root;&lt;br /&gt;
    use dom::bindings::reflector::Reflector;&lt;br /&gt;
    use dom::mutationrecord::MutationRecord;&lt;br /&gt;
    use dom::node::Node;&lt;br /&gt;
    &lt;br /&gt;
    #[dom_struct]&lt;br /&gt;
    pub struct MutationObserver {&lt;br /&gt;
      reflector_: Reflector,&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationObserver {&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationObserverMethods for MutationObserver {&lt;br /&gt;
    &lt;br /&gt;
      //void observe(Node target, optional MutationObserverInit options);&lt;br /&gt;
      fn Observe(&amp;amp;self, target: &amp;amp;Node, options: &amp;amp;MutationObserverInit) {&lt;br /&gt;
    	// TODO implement&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
      //void disconnect();&lt;br /&gt;
      fn Disconnect(&amp;amp;self) {&lt;br /&gt;
    	// TODO implement&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      //sequence&amp;lt;MutationRecord&amp;gt; takeRecords();&lt;br /&gt;
      fn TakeRecords(&amp;amp;self) -&amp;gt; Vec&amp;lt;Root&amp;lt;MutationRecord&amp;gt;&amp;gt; {&lt;br /&gt;
          return vec![];&lt;br /&gt;
    	//TODO implement&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
    '''components/script/dom/mutationrecord.rs'''&lt;br /&gt;
    use core::ptr::null;&lt;br /&gt;
    use dom_struct::dom_struct;&lt;br /&gt;
    use dom::bindings::codegen::Bindings::MutationRecordBinding::MutationRecordBinding::MutationRecordMethods;&lt;br /&gt;
    use dom::bindings::js::{JS, Root};&lt;br /&gt;
    use dom::bindings::str::DOMString;&lt;br /&gt;
    use dom::bindings::reflector::Reflector;&lt;br /&gt;
    use dom::node::Node;&lt;br /&gt;
    use dom::nodelist::NodeList;&lt;br /&gt;
    use dom::window::Window;&lt;br /&gt;
    &lt;br /&gt;
    #[dom_struct]&lt;br /&gt;
    pub struct MutationRecord {&lt;br /&gt;
      reflector_: Reflector,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString record_type;&lt;br /&gt;
      record_type: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute Node target;&lt;br /&gt;
      target: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute NodeList addedNodes;&lt;br /&gt;
      addedNodes: Root&amp;lt;NodeList&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute NodeList removedNodes;&lt;br /&gt;
      removedNodes: Root&amp;lt;NodeList&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute Node? previousSibling;&lt;br /&gt;
      previousSibling: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute Node? nextSibling;&lt;br /&gt;
      nextSibling: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString? attributeName;&lt;br /&gt;
      attributeName: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString? attributeNamespace;&lt;br /&gt;
      attributeNamespace: DOMString,&lt;br /&gt;
    &lt;br /&gt;
   //  readonly attribute DOMString? oldValue;&lt;br /&gt;
      oldValue: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationRecord {&lt;br /&gt;
        fn new(window: &amp;amp;Window, record_type: DOMString, target: Root&amp;lt;Node&amp;gt;) -&amp;gt; Root&amp;lt;MutationRecord&amp;gt; {&lt;br /&gt;
            MutationRecord {&lt;br /&gt;
                reflector_: Reflector::new(),&lt;br /&gt;
                record_type: record_type,&lt;br /&gt;
                target: target,&lt;br /&gt;
                addedNodes: NodeList::empty(window),&lt;br /&gt;
                removedNodes: NodeList::empty(window),&lt;br /&gt;
                previousSibling: None,&lt;br /&gt;
                nextSibling: None,&lt;br /&gt;
                attributeName: None,&lt;br /&gt;
                attributeNamespace: None,&lt;br /&gt;
                oldValue: None,&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationRecordMethods for MutationRecord {&lt;br /&gt;
    &lt;br /&gt;
      fn Type(&amp;amp;self) -&amp;gt; DOMString {&lt;br /&gt;
          return self.record_type;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn Target(&amp;amp;self) -&amp;gt; Root&amp;lt;Node&amp;gt; {&lt;br /&gt;
          return self.target;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn AddedNodes(&amp;amp;self) -&amp;gt; Root&amp;lt;NodeList&amp;gt; {&lt;br /&gt;
          return self.addedNodes;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn RemovedNodes(&amp;amp;self) -&amp;gt; Root&amp;lt;NodeList&amp;gt; {&lt;br /&gt;
          return self.removedNodes;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetPreviousSibling(&amp;amp;self) -&amp;gt; Option&amp;lt;Root&amp;lt;Node&amp;gt;&amp;gt; {&lt;br /&gt;
          if self.previousSibling.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.previousSibling);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetNextSibling(&amp;amp;self) -&amp;gt; Option&amp;lt;Root&amp;lt;Node&amp;gt;&amp;gt; {&lt;br /&gt;
          if self.nextSibling.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.nextSibling);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetAttributeName(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
          if self.attributeName.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.attributeName);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetAttributeNamespace(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
          if self.attributeNamespace.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.attributeNamespace);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetOldValue(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
          if self.oldValue.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.oldValue);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
    } &lt;br /&gt;
***Added the new Interfeces in the &amp;lt;code&amp;gt;mod.rs&amp;lt;/code&amp;gt; file:&lt;br /&gt;
    '''components/script/dom/mod.rs'''&lt;br /&gt;
    ...&lt;br /&gt;
    pub mod mutationobserver;&lt;br /&gt;
    pub mod mutationrecord;&lt;br /&gt;
    ...&lt;br /&gt;
***Added the new Interface bindings in the file:&lt;br /&gt;
    '''components/script/dom/bindings/codegen/Bindings.conf'''&lt;br /&gt;
    ...&lt;br /&gt;
    DOMInterfaces = {&lt;br /&gt;
    ...&lt;br /&gt;
    'MutationObserver': {&lt;br /&gt;
      'nativeType': 'MutationObserver',&lt;br /&gt;
      'path': 'dom::mutationobserver::MutationObserver',&lt;br /&gt;
    },&lt;br /&gt;
    &lt;br /&gt;
    'MutationRecord': {&lt;br /&gt;
      'nativeType': 'MutationRecord',&lt;br /&gt;
      'path': 'dom::mutationrecord::MutationRecord',&lt;br /&gt;
    },&lt;br /&gt;
    ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
**We hid the new interfaces by default by adding a &amp;lt;code&amp;gt;[Pref=&amp;quot;dom.mutation_observer.enabled&amp;quot;]&amp;lt;/code&amp;gt; attribute to both &amp;lt;code&amp;gt;mutationobserver.rs&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mutationrecord.rs&amp;lt;/code&amp;gt; and added a corresponding preference to &amp;lt;code&amp;gt;resources/prefs.json&amp;lt;/code&amp;gt; file.&lt;br /&gt;
    '''resources/prefs.json'''&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;quot;dom.mutation_observer.enabled&amp;quot;: false,&lt;br /&gt;
    ...&lt;br /&gt;
*We added a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects as a member of the [https://github.com/servo/servo/blob/3c8daca772aacf59bffdff32b017f8029437a85e/components/script/script_thread.rs#L397 ScriptThread] as mentioed in the requirements.&lt;br /&gt;
    '''components/script/script_thread.rs'''&lt;br /&gt;
    ...&lt;br /&gt;
    pub struct ScriptThread {&lt;br /&gt;
      ...&lt;br /&gt;
      /// a vector of MutationObserver objects&lt;br /&gt;
      mutation_observers: Vec&amp;lt;MutationObserver&amp;gt;,&lt;br /&gt;
      ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
    impl ScriptThread {&lt;br /&gt;
      ...&lt;br /&gt;
      mutation_observers: vec![],&lt;br /&gt;
      ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
*Implemented the &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; constructor, by following the steps given in the [https://dom.spec.whatwg.org/#dom-mutationobserver-mutationobserver DOM Specifications].&lt;br /&gt;
    '''components/script/dom/mutationobserver.rs'''&lt;br /&gt;
    ...&lt;br /&gt;
    pub fn Constructor(global: &amp;amp;GlobalScope, callback: Rc&amp;lt;MutationCallback&amp;gt;) -&amp;gt; Result&amp;lt;Root&amp;lt;MutationObserver&amp;gt;, Error&amp;gt; {&lt;br /&gt;
      callback = &amp;amp;callback&lt;br /&gt;
      let mut frameBrowsingContext = Frames(&amp;amp;self)&lt;br /&gt;
      &lt;br /&gt;
      Ok(MutationObserver::new(global,this.callback)),&lt;br /&gt;
      Err(Error::new())&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
*Added a &amp;lt;code&amp;gt;__dir__.ini &amp;lt;/code&amp;gt; file to &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; for enabling the new preference by including &amp;lt;code&amp;gt;&amp;quot;prefs: [&amp;quot;dom.mutation_observer.enabled:true&amp;quot;]&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
    '''tests/wpt/metadata/dom/nodes/__dir__.ini'''&lt;br /&gt;
    prefs: [&amp;quot;dom.mutation_observer.enabled:true&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
*Tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
*The web-platform tests can be run by giving the following command at the root directory of the project:&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
*We have Updated the corresponding test expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in the &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
Our Project follows the [https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern], where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
After making the above mentioned changes, we can create the Mutation Observer Object using the Constructor which we have implemented.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Subsequent Steps'''==&lt;br /&gt;
After completing the above initial steps, we plan on performing the following tasks:&lt;br /&gt;
&lt;br /&gt;
*add support for mutation observer microtasks&lt;br /&gt;
**add a mutation_observer_compound_microtask_queued member to ScriptThread&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask] algorithm by adding a new variant to the [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask] enum for mutation observers&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers] algorithm (ignoring the specific text about &amp;quot;execute a compound microtask&amp;quot;) using the vector of observers previously added to ScriptThread&lt;br /&gt;
*add support for observing specific mutations&lt;br /&gt;
**add a vector of MutationObserver objects to Node&lt;br /&gt;
**implement [https://dom.spec.whatwg.org/#dom-mutationobserver-observe MutationObserver.observe] (step 7 and 8 mean &amp;quot;replace an existing matching entry with the new options, or add a new entry if there is no match&amp;quot;)&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record] algorithm&lt;br /&gt;
**make [https://dom.spec.whatwg.org/#concept-element-attributes-change changing]/[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]/[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]/[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing] an attribute queue a mutation record via [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value], [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute], and [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&lt;br /&gt;
&lt;br /&gt;
=='''Commit Frequency'''==&lt;br /&gt;
As per the guidelines of the Mozilla project, all the changes will be submitted in a single commit.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107291</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107291"/>
		<updated>2017-03-23T21:12:08Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Project Description */ formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The DOM standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Tracking issue'''==&lt;br /&gt;
The Original Tracking Issue for the project can be found at the [https://github.com/servo/servo/issues/6633 Tracking Issue] page of the [https://github.com/servo/servo/wiki/Mutation-observer-project Mutation Observer Project].&lt;br /&gt;
&lt;br /&gt;
=='''Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the [https://github.com/srivassumit/servo/wiki/Readme Read me] file of the project Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
*'''Initial steps for Stub method Implementation''':&lt;br /&gt;
**Created the [https://dom.spec.whatwg.org/#mutationobserver MutationObserver] and [https://dom.spec.whatwg.org/#mutationrecord MutationRecord] interfaces with stub method implementations following the guidelines given here: [http://doc.servo.org/script/dom/index.html#adding-a-new-dom-interface Adding a new DOM Interface]&lt;br /&gt;
***The IDL Files describe the Structure of the Mutation Observer and Mutation Record classes:&lt;br /&gt;
    '''MutationObserver IDL'''&lt;br /&gt;
    [Constructor(MutationCallback callback)]&lt;br /&gt;
    interface MutationObserver {&lt;br /&gt;
      void observe(Node target, optional MutationObserverInit options);&lt;br /&gt;
      void disconnect();&lt;br /&gt;
      sequence&amp;lt;MutationRecord&amp;gt; takeRecords();&lt;br /&gt;
    };&lt;br /&gt;
    &lt;br /&gt;
    callback MutationCallback  = void (sequence&amp;lt;MutationRecord&amp;gt; mutations, MutationObserver observer);&lt;br /&gt;
    &lt;br /&gt;
    dictionary MutationObserverInit {&lt;br /&gt;
      boolean childList = false;&lt;br /&gt;
      boolean attributes;&lt;br /&gt;
      boolean characterData;&lt;br /&gt;
      boolean subtree = false;&lt;br /&gt;
      boolean attributeOldValue;&lt;br /&gt;
      boolean characterDataOldValue;&lt;br /&gt;
      sequence&amp;lt;DOMString&amp;gt; attributeFilter;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    '''MutationRecord IDL'''&lt;br /&gt;
    [Exposed=Window]&lt;br /&gt;
    interface MutationRecord {&lt;br /&gt;
      readonly attribute DOMString type;&lt;br /&gt;
      [SameObject] readonly attribute Node target;&lt;br /&gt;
      [SameObject] readonly attribute NodeList addedNodes;&lt;br /&gt;
      [SameObject] readonly attribute NodeList removedNodes;&lt;br /&gt;
      readonly attribute Node? previousSibling;&lt;br /&gt;
      readonly attribute Node? nextSibling;&lt;br /&gt;
      readonly attribute DOMString? attributeName;&lt;br /&gt;
      readonly attribute DOMString? attributeNamespace;&lt;br /&gt;
      readonly attribute DOMString? oldValue;&lt;br /&gt;
    };&lt;br /&gt;
*** Added the new interfaces in the dom scripts folder:&lt;br /&gt;
    '''components/script/dom/mutationobserver.rs'''&lt;br /&gt;
    use core::ptr;&lt;br /&gt;
    use dom_struct::dom_struct;&lt;br /&gt;
    use dom::bindings::codegen::Bindings::MutationRecordBinding::MutationRecordBinding::MutationRecordMethods;&lt;br /&gt;
    use dom::bindings::js::{JS, Root};&lt;br /&gt;
    use dom::bindings::str::DOMString;&lt;br /&gt;
    use dom::bindings::reflector::Reflector;&lt;br /&gt;
    use dom::node::Node;&lt;br /&gt;
    use dom::nodelist::NodeList;&lt;br /&gt;
    use dom::window::Window;&lt;br /&gt;
    use std::default::Default; &lt;br /&gt;
    &lt;br /&gt;
    #[dom_struct]&lt;br /&gt;
    pub struct MutationRecord {&lt;br /&gt;
      reflector_: Reflector,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString record_type;&lt;br /&gt;
      record_type: DOMString,   &lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute Node target;&lt;br /&gt;
      target: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute NodeList addedNodes;&lt;br /&gt;
      addedNodes: Root&amp;lt;NodeList&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute NodeList removedNodes;&lt;br /&gt;
      removedNodes: Root&amp;lt;NodeList&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute Node? previousSibling;&lt;br /&gt;
      previousSibling: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute Node? nextSibling;&lt;br /&gt;
      nextSibling: Root&amp;lt;Node&amp;gt;,  &lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString? attributeName;&lt;br /&gt;
      attributeName: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString? attributeNamespace;&lt;br /&gt;
      attributeNamespace: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString? oldValue;&lt;br /&gt;
      oldValue: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationRecord {&lt;br /&gt;
        &lt;br /&gt;
    fn new(window: &amp;amp;Window, record_type: DOMString, target: Root&amp;lt;Node&amp;gt;) -&amp;gt; MutationRecord {&lt;br /&gt;
    		MutationRecord {&lt;br /&gt;
    			reflector_: Reflector::new(),&lt;br /&gt;
    			record_type: record_type,&lt;br /&gt;
    			target: target,&lt;br /&gt;
    			addedNodes: NodeList::empty(window),&lt;br /&gt;
    			removedNodes: NodeList::empty(window),&lt;br /&gt;
    			previousSibling: Root::from_ref(&amp;amp;*ptr::null()),&lt;br /&gt;
    			nextSibling: Root::from_ref(&amp;amp;*ptr::null()),&lt;br /&gt;
    			attributeName: Default::default(),&lt;br /&gt;
    			attributeNamespace: Default::default(),&lt;br /&gt;
    			oldValue: Default::default(),&lt;br /&gt;
    		}&lt;br /&gt;
    	}&lt;br /&gt;
    }    &lt;br /&gt;
    &lt;br /&gt;
    impl MutationRecordMethods for MutationRecord {   &lt;br /&gt;
    &lt;br /&gt;
      fn Type(&amp;amp;self) -&amp;gt; DOMString {&lt;br /&gt;
    	  return self.record_type;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn Target(&amp;amp;self) -&amp;gt; Root&amp;lt;Node&amp;gt; {&lt;br /&gt;
    	  return self.target;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn AddedNodes(&amp;amp;self) -&amp;gt; Root&amp;lt;NodeList&amp;gt; {&lt;br /&gt;
    	  return self.addedNodes;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn RemovedNodes(&amp;amp;self) -&amp;gt; Root&amp;lt;NodeList&amp;gt; {&lt;br /&gt;
    	  return self.removedNodes;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetPreviousSibling(&amp;amp;self) -&amp;gt; Option&amp;lt;Root&amp;lt;Node&amp;gt;&amp;gt; {&lt;br /&gt;
    	  Some(self.previousSibling)&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetNextSibling(&amp;amp;self) -&amp;gt; Option&amp;lt;Root&amp;lt;Node&amp;gt;&amp;gt; {&lt;br /&gt;
    	  Some(self.nextSibling)&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetAttributeName(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
    	  Some(self.attributeName)&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetAttributeNamespace(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
    	  Some(self.attributeNamespace)&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetOldValue(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
    	  Some(self.oldValue)&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    '''components/script/dom/mutationrecord.rs'''&lt;br /&gt;
    use core::ptr::null;&lt;br /&gt;
    use dom_struct::dom_struct;&lt;br /&gt;
    use dom::bindings::codegen::Bindings::MutationRecordBinding::MutationRecordBinding::MutationRecordMethods;&lt;br /&gt;
    use dom::bindings::js::{JS, Root};&lt;br /&gt;
    use dom::bindings::str::DOMString;&lt;br /&gt;
    use dom::bindings::reflector::Reflector;&lt;br /&gt;
    use dom::node::Node;&lt;br /&gt;
    use dom::nodelist::NodeList;&lt;br /&gt;
    use dom::window::Window;&lt;br /&gt;
    &lt;br /&gt;
    #[dom_struct]&lt;br /&gt;
    pub struct MutationRecord {&lt;br /&gt;
      reflector_: Reflector,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString record_type;&lt;br /&gt;
      record_type: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute Node target;&lt;br /&gt;
      target: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute NodeList addedNodes;&lt;br /&gt;
      addedNodes: Root&amp;lt;NodeList&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute NodeList removedNodes;&lt;br /&gt;
      removedNodes: Root&amp;lt;NodeList&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute Node? previousSibling;&lt;br /&gt;
      previousSibling: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute Node? nextSibling;&lt;br /&gt;
      nextSibling: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString? attributeName;&lt;br /&gt;
      attributeName: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString? attributeNamespace;&lt;br /&gt;
      attributeNamespace: DOMString,&lt;br /&gt;
    &lt;br /&gt;
   //  readonly attribute DOMString? oldValue;&lt;br /&gt;
      oldValue: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationRecord {&lt;br /&gt;
        fn new(window: &amp;amp;Window, record_type: DOMString, target: Root&amp;lt;Node&amp;gt;) -&amp;gt; Root&amp;lt;MutationRecord&amp;gt; {&lt;br /&gt;
            MutationRecord {&lt;br /&gt;
                reflector_: Reflector::new(),&lt;br /&gt;
                record_type: record_type,&lt;br /&gt;
                target: target,&lt;br /&gt;
                addedNodes: NodeList::empty(window),&lt;br /&gt;
                removedNodes: NodeList::empty(window),&lt;br /&gt;
                previousSibling: None,&lt;br /&gt;
                nextSibling: None,&lt;br /&gt;
                attributeName: None,&lt;br /&gt;
                attributeNamespace: None,&lt;br /&gt;
                oldValue: None,&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationRecordMethods for MutationRecord {&lt;br /&gt;
    &lt;br /&gt;
      fn Type(&amp;amp;self) -&amp;gt; DOMString {&lt;br /&gt;
          return self.record_type;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn Target(&amp;amp;self) -&amp;gt; Root&amp;lt;Node&amp;gt; {&lt;br /&gt;
          return self.target;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn AddedNodes(&amp;amp;self) -&amp;gt; Root&amp;lt;NodeList&amp;gt; {&lt;br /&gt;
          return self.addedNodes;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn RemovedNodes(&amp;amp;self) -&amp;gt; Root&amp;lt;NodeList&amp;gt; {&lt;br /&gt;
          return self.removedNodes;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetPreviousSibling(&amp;amp;self) -&amp;gt; Option&amp;lt;Root&amp;lt;Node&amp;gt;&amp;gt; {&lt;br /&gt;
          if self.previousSibling.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.previousSibling);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetNextSibling(&amp;amp;self) -&amp;gt; Option&amp;lt;Root&amp;lt;Node&amp;gt;&amp;gt; {&lt;br /&gt;
          if self.nextSibling.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.nextSibling);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetAttributeName(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
          if self.attributeName.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.attributeName);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetAttributeNamespace(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
          if self.attributeNamespace.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.attributeNamespace);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetOldValue(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
          if self.oldValue.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.oldValue);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
    } &lt;br /&gt;
***Added the new Interfeces in the &amp;lt;code&amp;gt;mod.rs&amp;lt;/code&amp;gt; file:&lt;br /&gt;
    '''components/script/dom/mod.rs'''&lt;br /&gt;
    ...&lt;br /&gt;
    pub mod mutationobserver;&lt;br /&gt;
    pub mod mutationrecord;&lt;br /&gt;
    ...&lt;br /&gt;
***Added the new Interface bindings in the file:&lt;br /&gt;
    '''components/script/dom/bindings/codegen/Bindings.conf'''&lt;br /&gt;
    ...&lt;br /&gt;
    DOMInterfaces = {&lt;br /&gt;
    ...&lt;br /&gt;
    'MutationObserver': {&lt;br /&gt;
      'nativeType': 'MutationObserver',&lt;br /&gt;
      'path': 'dom::mutationobserver::MutationObserver',&lt;br /&gt;
    },&lt;br /&gt;
    &lt;br /&gt;
    'MutationRecord': {&lt;br /&gt;
      'nativeType': 'MutationRecord',&lt;br /&gt;
      'path': 'dom::mutationrecord::MutationRecord',&lt;br /&gt;
    },&lt;br /&gt;
    ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
**We hid the new interfaces by default by adding a &amp;lt;code&amp;gt;[Pref=&amp;quot;dom.mutation_observer.enabled&amp;quot;]&amp;lt;/code&amp;gt; attribute to both &amp;lt;code&amp;gt;mutationobserver.rs&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mutationrecord.rs&amp;lt;/code&amp;gt; and added a corresponding preference to &amp;lt;code&amp;gt;resources/prefs.json&amp;lt;/code&amp;gt; file.&lt;br /&gt;
    '''resources/prefs.json'''&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;quot;dom.mutation_observer.enabled&amp;quot;: false,&lt;br /&gt;
    ...&lt;br /&gt;
*We added a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects as a member of the [https://github.com/servo/servo/blob/3c8daca772aacf59bffdff32b017f8029437a85e/components/script/script_thread.rs#L397 ScriptThread] as mentioed in the requirements.&lt;br /&gt;
    '''components/script/script_thread.rs'''&lt;br /&gt;
    ...&lt;br /&gt;
    pub struct ScriptThread {&lt;br /&gt;
      ...&lt;br /&gt;
      /// a vector of MutationObserver objects&lt;br /&gt;
      mutation_observers: Vec&amp;lt;MutationObserver&amp;gt;,&lt;br /&gt;
      ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
    impl ScriptThread {&lt;br /&gt;
      ...&lt;br /&gt;
      mutation_observers: vec![],&lt;br /&gt;
      ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
*Implemented the &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; constructor, by following the steps given in the [https://dom.spec.whatwg.org/#dom-mutationobserver-mutationobserver DOM Specifications].&lt;br /&gt;
    '''components/script/dom/mutationobserver.rs'''&lt;br /&gt;
    ...&lt;br /&gt;
    pub fn Constructor(global: &amp;amp;GlobalScope, callback: Rc&amp;lt;MutationCallback&amp;gt;) -&amp;gt; Result&amp;lt;Root&amp;lt;MutationObserver&amp;gt;, Error&amp;gt; {&lt;br /&gt;
      callback = &amp;amp;callback&lt;br /&gt;
      let mut frameBrowsingContext = Frames(&amp;amp;self)&lt;br /&gt;
      &lt;br /&gt;
      Ok(MutationObserver::new(global,this.callback)),&lt;br /&gt;
      Err(Error::new())&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
*Added a &amp;lt;code&amp;gt;__dir__.ini &amp;lt;/code&amp;gt; file to &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; for enabling the new preference by including &amp;lt;code&amp;gt;&amp;quot;prefs: [&amp;quot;dom.mutation_observer.enabled:true&amp;quot;]&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
    '''tests/wpt/metadata/dom/nodes/__dir__.ini'''&lt;br /&gt;
    prefs: [&amp;quot;dom.mutation_observer.enabled:true&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
*Tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
*The web-platform tests can be run by giving the following command at the root directory of the project:&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
*We have Updated the corresponding test expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in the &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
Our Project follows the [https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern], where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
After making the above mentioned changes, we can create the Mutation Observer Object using the Constructor which we have implemented.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Subsequent Steps'''==&lt;br /&gt;
After completing the above initial steps, we plan on performing the following tasks:&lt;br /&gt;
&lt;br /&gt;
*add support for mutation observer microtasks&lt;br /&gt;
**add a mutation_observer_compound_microtask_queued member to ScriptThread&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask] algorithm by adding a new variant to the [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask] enum for mutation observers&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers] algorithm (ignoring the specific text about &amp;quot;execute a compound microtask&amp;quot;) using the vector of observers previously added to ScriptThread&lt;br /&gt;
*add support for observing specific mutations&lt;br /&gt;
**add a vector of MutationObserver objects to Node&lt;br /&gt;
**implement [https://dom.spec.whatwg.org/#dom-mutationobserver-observe MutationObserver.observe] (step 7 and 8 mean &amp;quot;replace an existing matching entry with the new options, or add a new entry if there is no match&amp;quot;)&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record] algorithm&lt;br /&gt;
**make [https://dom.spec.whatwg.org/#concept-element-attributes-change changing]/[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]/[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]/[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing] an attribute queue a mutation record via [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value], [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute], and [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&lt;br /&gt;
&lt;br /&gt;
=='''Commit Frequency'''==&lt;br /&gt;
As per the guidelines of the Mozilla project, all the changes will be submitted in a single commit.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107290</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107290"/>
		<updated>2017-03-23T21:08:38Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: added parts for Implementation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The DOM standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Tracking issue'''==&lt;br /&gt;
The Original Tracking Issue for the project can be found at the [https://github.com/servo/servo/issues/6633 Tracking Issue] page of the [https://github.com/servo/servo/wiki/Mutation-observer-project Mutation Observer Project].&lt;br /&gt;
&lt;br /&gt;
=='''Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the [https://github.com/srivassumit/servo/wiki/Readme Read me] file of the project Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
*'''Initial steps for Stub method Implementation''':&lt;br /&gt;
**Created the [https://dom.spec.whatwg.org/#mutationobserver MutationObserver] and [https://dom.spec.whatwg.org/#mutationrecord MutationRecord] interfaces with stub method implementations following the guidelines given here: [http://doc.servo.org/script/dom/index.html#adding-a-new-dom-interface Adding a new DOM Interface]&lt;br /&gt;
&lt;br /&gt;
***The IDL Files describe the Structure of the Mutation Observer and Mutation Record classes:&lt;br /&gt;
    '''MutationObserver IDL'''&lt;br /&gt;
    [Constructor(MutationCallback callback)]&lt;br /&gt;
    interface MutationObserver {&lt;br /&gt;
      void observe(Node target, optional MutationObserverInit options);&lt;br /&gt;
      void disconnect();&lt;br /&gt;
      sequence&amp;lt;MutationRecord&amp;gt; takeRecords();&lt;br /&gt;
    };&lt;br /&gt;
    &lt;br /&gt;
    callback MutationCallback  = void (sequence&amp;lt;MutationRecord&amp;gt; mutations, MutationObserver observer);&lt;br /&gt;
    &lt;br /&gt;
    dictionary MutationObserverInit {&lt;br /&gt;
      boolean childList = false;&lt;br /&gt;
      boolean attributes;&lt;br /&gt;
      boolean characterData;&lt;br /&gt;
      boolean subtree = false;&lt;br /&gt;
      boolean attributeOldValue;&lt;br /&gt;
      boolean characterDataOldValue;&lt;br /&gt;
      sequence&amp;lt;DOMString&amp;gt; attributeFilter;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    '''MutationRecord IDL'''&lt;br /&gt;
    [Exposed=Window]&lt;br /&gt;
    interface MutationRecord {&lt;br /&gt;
      readonly attribute DOMString type;&lt;br /&gt;
      [SameObject] readonly attribute Node target;&lt;br /&gt;
      [SameObject] readonly attribute NodeList addedNodes;&lt;br /&gt;
      [SameObject] readonly attribute NodeList removedNodes;&lt;br /&gt;
      readonly attribute Node? previousSibling;&lt;br /&gt;
      readonly attribute Node? nextSibling;&lt;br /&gt;
      readonly attribute DOMString? attributeName;&lt;br /&gt;
      readonly attribute DOMString? attributeNamespace;&lt;br /&gt;
      readonly attribute DOMString? oldValue;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
*** Added the new interfaces in the dom scripts folder:&lt;br /&gt;
    '''components/script/dom/mutationobserver.rs'''&lt;br /&gt;
    use core::ptr;&lt;br /&gt;
    use dom_struct::dom_struct;&lt;br /&gt;
    use dom::bindings::codegen::Bindings::MutationRecordBinding::MutationRecordBinding::MutationRecordMethods;&lt;br /&gt;
    use dom::bindings::js::{JS, Root};&lt;br /&gt;
    use dom::bindings::str::DOMString;&lt;br /&gt;
    use dom::bindings::reflector::Reflector;&lt;br /&gt;
    use dom::node::Node;&lt;br /&gt;
    use dom::nodelist::NodeList;&lt;br /&gt;
    use dom::window::Window;&lt;br /&gt;
    use std::default::Default; &lt;br /&gt;
    &lt;br /&gt;
    #[dom_struct]&lt;br /&gt;
    pub struct MutationRecord {&lt;br /&gt;
      reflector_: Reflector,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString record_type;&lt;br /&gt;
      record_type: DOMString,   &lt;br /&gt;
&lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute Node target;&lt;br /&gt;
      target: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute NodeList addedNodes;&lt;br /&gt;
      addedNodes: Root&amp;lt;NodeList&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute NodeList removedNodes;&lt;br /&gt;
      removedNodes: Root&amp;lt;NodeList&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute Node? previousSibling;&lt;br /&gt;
      previousSibling: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute Node? nextSibling;&lt;br /&gt;
      nextSibling: Root&amp;lt;Node&amp;gt;,  &lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString? attributeName;&lt;br /&gt;
      attributeName: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString? attributeNamespace;&lt;br /&gt;
      attributeNamespace: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString? oldValue;&lt;br /&gt;
      oldValue: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationRecord {&lt;br /&gt;
        &lt;br /&gt;
    fn new(window: &amp;amp;Window, record_type: DOMString, target: Root&amp;lt;Node&amp;gt;) -&amp;gt; MutationRecord {&lt;br /&gt;
    		MutationRecord {&lt;br /&gt;
    			reflector_: Reflector::new(),&lt;br /&gt;
    			record_type: record_type,&lt;br /&gt;
    			target: target,&lt;br /&gt;
    			addedNodes: NodeList::empty(window),&lt;br /&gt;
    			removedNodes: NodeList::empty(window),&lt;br /&gt;
    			previousSibling: Root::from_ref(&amp;amp;*ptr::null()),&lt;br /&gt;
    			nextSibling: Root::from_ref(&amp;amp;*ptr::null()),&lt;br /&gt;
    			attributeName: Default::default(),&lt;br /&gt;
    			attributeNamespace: Default::default(),&lt;br /&gt;
    			oldValue: Default::default(),&lt;br /&gt;
    		}&lt;br /&gt;
    	}&lt;br /&gt;
    }    &lt;br /&gt;
    &lt;br /&gt;
    impl MutationRecordMethods for MutationRecord {   &lt;br /&gt;
    &lt;br /&gt;
      fn Type(&amp;amp;self) -&amp;gt; DOMString {&lt;br /&gt;
    	  return self.record_type;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn Target(&amp;amp;self) -&amp;gt; Root&amp;lt;Node&amp;gt; {&lt;br /&gt;
    	  return self.target;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn AddedNodes(&amp;amp;self) -&amp;gt; Root&amp;lt;NodeList&amp;gt; {&lt;br /&gt;
    	  return self.addedNodes;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn RemovedNodes(&amp;amp;self) -&amp;gt; Root&amp;lt;NodeList&amp;gt; {&lt;br /&gt;
    	  return self.removedNodes;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetPreviousSibling(&amp;amp;self) -&amp;gt; Option&amp;lt;Root&amp;lt;Node&amp;gt;&amp;gt; {&lt;br /&gt;
    	  Some(self.previousSibling)&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetNextSibling(&amp;amp;self) -&amp;gt; Option&amp;lt;Root&amp;lt;Node&amp;gt;&amp;gt; {&lt;br /&gt;
    	  Some(self.nextSibling)&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetAttributeName(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
    	  Some(self.attributeName)&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetAttributeNamespace(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
    	  Some(self.attributeNamespace)&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetOldValue(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
    	  Some(self.oldValue)&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    '''components/script/dom/mutationrecord.rs'''&lt;br /&gt;
    use core::ptr::null;&lt;br /&gt;
    use dom_struct::dom_struct;&lt;br /&gt;
    use dom::bindings::codegen::Bindings::MutationRecordBinding::MutationRecordBinding::MutationRecordMethods;&lt;br /&gt;
    use dom::bindings::js::{JS, Root};&lt;br /&gt;
    use dom::bindings::str::DOMString;&lt;br /&gt;
    use dom::bindings::reflector::Reflector;&lt;br /&gt;
    use dom::node::Node;&lt;br /&gt;
    use dom::nodelist::NodeList;&lt;br /&gt;
    use dom::window::Window;&lt;br /&gt;
    &lt;br /&gt;
    #[dom_struct]&lt;br /&gt;
    pub struct MutationRecord {&lt;br /&gt;
      reflector_: Reflector,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString record_type;&lt;br /&gt;
      record_type: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute Node target;&lt;br /&gt;
      target: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute NodeList addedNodes;&lt;br /&gt;
      addedNodes: Root&amp;lt;NodeList&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  [SameObject]&lt;br /&gt;
    //  readonly attribute NodeList removedNodes;&lt;br /&gt;
      removedNodes: Root&amp;lt;NodeList&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute Node? previousSibling;&lt;br /&gt;
      previousSibling: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute Node? nextSibling;&lt;br /&gt;
      nextSibling: Root&amp;lt;Node&amp;gt;,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString? attributeName;&lt;br /&gt;
      attributeName: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    //  readonly attribute DOMString? attributeNamespace;&lt;br /&gt;
      attributeNamespace: DOMString,&lt;br /&gt;
    &lt;br /&gt;
   //  readonly attribute DOMString? oldValue;&lt;br /&gt;
      oldValue: DOMString,&lt;br /&gt;
    &lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationRecord {&lt;br /&gt;
        fn new(window: &amp;amp;Window, record_type: DOMString, target: Root&amp;lt;Node&amp;gt;) -&amp;gt; Root&amp;lt;MutationRecord&amp;gt; {&lt;br /&gt;
            MutationRecord {&lt;br /&gt;
                reflector_: Reflector::new(),&lt;br /&gt;
                record_type: record_type,&lt;br /&gt;
                target: target,&lt;br /&gt;
                addedNodes: NodeList::empty(window),&lt;br /&gt;
                removedNodes: NodeList::empty(window),&lt;br /&gt;
                previousSibling: None,&lt;br /&gt;
                nextSibling: None,&lt;br /&gt;
                attributeName: None,&lt;br /&gt;
                attributeNamespace: None,&lt;br /&gt;
                oldValue: None,&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    impl MutationRecordMethods for MutationRecord {&lt;br /&gt;
    &lt;br /&gt;
      fn Type(&amp;amp;self) -&amp;gt; DOMString {&lt;br /&gt;
          return self.record_type;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn Target(&amp;amp;self) -&amp;gt; Root&amp;lt;Node&amp;gt; {&lt;br /&gt;
          return self.target;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn AddedNodes(&amp;amp;self) -&amp;gt; Root&amp;lt;NodeList&amp;gt; {&lt;br /&gt;
          return self.addedNodes;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn RemovedNodes(&amp;amp;self) -&amp;gt; Root&amp;lt;NodeList&amp;gt; {&lt;br /&gt;
          return self.removedNodes;&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetPreviousSibling(&amp;amp;self) -&amp;gt; Option&amp;lt;Root&amp;lt;Node&amp;gt;&amp;gt; {&lt;br /&gt;
          if self.previousSibling.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.previousSibling);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetNextSibling(&amp;amp;self) -&amp;gt; Option&amp;lt;Root&amp;lt;Node&amp;gt;&amp;gt; {&lt;br /&gt;
          if self.nextSibling.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.nextSibling);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetAttributeName(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
          if self.attributeName.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.attributeName);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetAttributeNamespace(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
          if self.attributeNamespace.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.attributeNamespace);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
      fn GetOldValue(&amp;amp;self) -&amp;gt; Option&amp;lt;DOMString&amp;gt; {&lt;br /&gt;
          if self.oldValue.is_null() {&lt;br /&gt;
              return None;&lt;br /&gt;
          } else {&lt;br /&gt;
              return Some(self.oldValue);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
    &lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
*** Added the new Interfeces in the &amp;lt;code&amp;gt;mod.rs&amp;lt;/code&amp;gt; file:&lt;br /&gt;
    '''components/script/dom/mod.rs'''&lt;br /&gt;
    ...&lt;br /&gt;
    pub mod mutationobserver;&lt;br /&gt;
    pub mod mutationrecord;&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
***Added the new Interface bindings in the file:&lt;br /&gt;
    '''components/script/dom/bindings/codegen/Bindings.conf'''&lt;br /&gt;
    ...&lt;br /&gt;
    DOMInterfaces = {&lt;br /&gt;
    ...&lt;br /&gt;
    'MutationObserver': {&lt;br /&gt;
      'nativeType': 'MutationObserver',&lt;br /&gt;
      'path': 'dom::mutationobserver::MutationObserver',&lt;br /&gt;
    },&lt;br /&gt;
    &lt;br /&gt;
    'MutationRecord': {&lt;br /&gt;
      'nativeType': 'MutationRecord',&lt;br /&gt;
      'path': 'dom::mutationrecord::MutationRecord',&lt;br /&gt;
    },&lt;br /&gt;
    ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
*We hid the new interfaces by default by adding a &amp;lt;code&amp;gt;[Pref=&amp;quot;dom.mutation_observer.enabled&amp;quot;]&amp;lt;/code&amp;gt; attribute to both &amp;lt;code&amp;gt;mutationobserver.rs&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mutationrecord.rs&amp;lt;/code&amp;gt; and added a corresponding preference to &amp;lt;code&amp;gt;resources/prefs.json&amp;lt;/code&amp;gt; file.&lt;br /&gt;
    '''resources/prefs.json'''&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;quot;dom.mutation_observer.enabled&amp;quot;: false,&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
*We added a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects as a member of the [https://github.com/servo/servo/blob/3c8daca772aacf59bffdff32b017f8029437a85e/components/script/script_thread.rs#L397 ScriptThread] as mentioed in the requirements.&lt;br /&gt;
    '''components/script/script_thread.rs'''&lt;br /&gt;
    ...&lt;br /&gt;
    pub struct ScriptThread {&lt;br /&gt;
      ...&lt;br /&gt;
      /// a vector of MutationObserver objects&lt;br /&gt;
      mutation_observers: Vec&amp;lt;MutationObserver&amp;gt;,&lt;br /&gt;
      ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
    impl ScriptThread {&lt;br /&gt;
      ...&lt;br /&gt;
      mutation_observers: vec![],&lt;br /&gt;
      ...&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
*Implemented the &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; constructor, by following the steps given in the [https://dom.spec.whatwg.org/#dom-mutationobserver-mutationobserver DOM Specifications].&lt;br /&gt;
    '''components/script/dom/mutationobserver.rs'''&lt;br /&gt;
    ...&lt;br /&gt;
    pub fn Constructor(global: &amp;amp;GlobalScope, callback: Rc&amp;lt;MutationCallback&amp;gt;) -&amp;gt; Result&amp;lt;Root&amp;lt;MutationObserver&amp;gt;, Error&amp;gt; {&lt;br /&gt;
      callback = &amp;amp;callback&lt;br /&gt;
      let mut frameBrowsingContext = Frames(&amp;amp;self)&lt;br /&gt;
      &lt;br /&gt;
      Ok(MutationObserver::new(global,this.callback)),&lt;br /&gt;
      Err(Error::new())&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
*Added a &amp;lt;code&amp;gt;__dir__.ini &amp;lt;/code&amp;gt; file to &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; for enabling the new preference by including &amp;lt;code&amp;gt;&amp;quot;prefs: [&amp;quot;dom.mutation_observer.enabled:true&amp;quot;]&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
    '''tests/wpt/metadata/dom/nodes/__dir__.ini'''&lt;br /&gt;
    prefs: [&amp;quot;dom.mutation_observer.enabled:true&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
*Tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
*The web-platform tests can be run by giving the following command at the root directory of the project:&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
*We have Updated the corresponding test expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in the &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
Our Project follows the [https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern], where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
After making the above mentioned changes, we can create the Mutation Observer Object using the Constructor which we have implemented.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Subsequent Steps'''==&lt;br /&gt;
After completing the above initial steps, we plan on performing the following tasks:&lt;br /&gt;
&lt;br /&gt;
*add support for mutation observer microtasks&lt;br /&gt;
**add a mutation_observer_compound_microtask_queued member to ScriptThread&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask] algorithm by adding a new variant to the [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask] enum for mutation observers&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers] algorithm (ignoring the specific text about &amp;quot;execute a compound microtask&amp;quot;) using the vector of observers previously added to ScriptThread&lt;br /&gt;
*add support for observing specific mutations&lt;br /&gt;
**add a vector of MutationObserver objects to Node&lt;br /&gt;
**implement [https://dom.spec.whatwg.org/#dom-mutationobserver-observe MutationObserver.observe] (step 7 and 8 mean &amp;quot;replace an existing matching entry with the new options, or add a new entry if there is no match&amp;quot;)&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record] algorithm&lt;br /&gt;
**make [https://dom.spec.whatwg.org/#concept-element-attributes-change changing]/[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]/[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]/[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing] an attribute queue a mutation record via [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value], [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute], and [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&lt;br /&gt;
&lt;br /&gt;
=='''Commit Frequency'''==&lt;br /&gt;
As per the guidelines of the Mozilla project, all the changes will be submitted in a single commit.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107283</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107283"/>
		<updated>2017-03-23T20:31:15Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The DOM standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source prototype web browser layout engine being developed by Mozilla, and it is written in [https://www.rust-lang.org/ Rust] language. The main idea is to create a highly parallel environment, in which different components can be handled by fine grained, isolated tasks. The different components can be rendering, HTML parsing, etc. &lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Tracking issue'''==&lt;br /&gt;
The Original Tracking Issue for the project can be found at the [https://github.com/servo/servo/issues/6633 Tracking Issue] page of the [https://github.com/servo/servo/wiki/Mutation-observer-project Mutation Observer Project].&lt;br /&gt;
&lt;br /&gt;
=='''Building the Project'''==&lt;br /&gt;
Follow the Guidelines mentioned in the [https://github.com/srivassumit/servo/wiki/Readme Read me] file of the project Wiki Page for building the Project in a Linux Environment.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
*'''Initial steps for Stub method Implementation''':&lt;br /&gt;
**Created the [https://dom.spec.whatwg.org/#mutationobserver MutationObserver] and [https://dom.spec.whatwg.org/#mutationrecord MutationRecord] interfaces with stub method implementations following the guidelines given here: [http://doc.servo.org/script/dom/index.html#adding-a-new-dom-interface Adding a new DOM Interface]&lt;br /&gt;
    '''MutationObserver IDL'''&lt;br /&gt;
    [Constructor(MutationCallback callback)]&lt;br /&gt;
    interface MutationObserver {&lt;br /&gt;
      void observe(Node target, optional MutationObserverInit options);&lt;br /&gt;
      void disconnect();&lt;br /&gt;
      sequence&amp;lt;MutationRecord&amp;gt; takeRecords();&lt;br /&gt;
    };&lt;br /&gt;
    &lt;br /&gt;
    callback MutationCallback  = void (sequence&amp;lt;MutationRecord&amp;gt; mutations, MutationObserver observer);&lt;br /&gt;
    &lt;br /&gt;
    dictionary MutationObserverInit {&lt;br /&gt;
      boolean childList = false;&lt;br /&gt;
      boolean attributes;&lt;br /&gt;
      boolean characterData;&lt;br /&gt;
      boolean subtree = false;&lt;br /&gt;
      boolean attributeOldValue;&lt;br /&gt;
      boolean characterDataOldValue;&lt;br /&gt;
      sequence&amp;lt;DOMString&amp;gt; attributeFilter;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    '''MutationRecord IDL'''&lt;br /&gt;
    [Exposed=Window]&lt;br /&gt;
    interface MutationRecord {&lt;br /&gt;
      readonly attribute DOMString type;&lt;br /&gt;
      [SameObject] readonly attribute Node target;&lt;br /&gt;
      [SameObject] readonly attribute NodeList addedNodes;&lt;br /&gt;
      [SameObject] readonly attribute NodeList removedNodes;&lt;br /&gt;
      readonly attribute Node? previousSibling;&lt;br /&gt;
      readonly attribute Node? nextSibling;&lt;br /&gt;
      readonly attribute DOMString? attributeName;&lt;br /&gt;
      readonly attribute DOMString? attributeNamespace;&lt;br /&gt;
      readonly attribute DOMString? oldValue;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
*We hid the new interfaces by default by adding a &amp;lt;code&amp;gt;[Pref=&amp;quot;dom.mutation_observer.enabled&amp;quot;]&amp;lt;/code&amp;gt; attribute to both &amp;lt;code&amp;gt;mutationobserver.rs&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mutationrecord.rs&amp;lt;/code&amp;gt; and added a corresponding preference to &amp;lt;code&amp;gt;resources/prefs.json&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
*Added a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects as a member of the [https://github.com/servo/servo/blob/3c8daca772aacf59bffdff32b017f8029437a85e/components/script/script_thread.rs#L397 ScriptThread] as mentioed in the requirements.&lt;br /&gt;
*Implemented the &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; constructor, by following the steps given in the [https://dom.spec.whatwg.org/#dom-mutationobserver-mutationobserver DOM Specifications].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
*Added a &amp;lt;code&amp;gt;__dir__.ini &amp;lt;/code&amp;gt; file to &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; for enabling the new preference by including &amp;lt;code&amp;gt;&amp;quot;prefs: [&amp;quot;dom.mutation_observer.enabled:true&amp;quot;]&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
*Tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
*The web-platform tests can be run by giving the following command at the root directory of the project:&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
*We have Updated the corresponding test expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in the &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
Our Project follows the [https://en.wikipedia.org/wiki/Observer_pattern Observer Pattern], where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
After making the above mentioned changes, we can create the Mutation Observer Object using the Constructor which we have implemented.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Subsequent Steps'''==&lt;br /&gt;
After completing the above initial steps, we plan on performing the following tasks:&lt;br /&gt;
&lt;br /&gt;
*add support for mutation observer microtasks&lt;br /&gt;
**add a mutation_observer_compound_microtask_queued member to ScriptThread&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask] algorithm by adding a new variant to the [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask] enum for mutation observers&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers] algorithm (ignoring the specific text about &amp;quot;execute a compound microtask&amp;quot;) using the vector of observers previously added to ScriptThread&lt;br /&gt;
*add support for observing specific mutations&lt;br /&gt;
**add a vector of MutationObserver objects to Node&lt;br /&gt;
**implement [https://dom.spec.whatwg.org/#dom-mutationobserver-observe MutationObserver.observe] (step 7 and 8 mean &amp;quot;replace an existing matching entry with the new options, or add a new entry if there is no match&amp;quot;)&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record] algorithm&lt;br /&gt;
**make [https://dom.spec.whatwg.org/#concept-element-attributes-change changing]/[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]/[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]/[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing] an attribute queue a mutation record via [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value], [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute], and [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&lt;br /&gt;
&lt;br /&gt;
=='''Commit Frequency'''==&lt;br /&gt;
As per the guidelines of the Mozilla project, all the changes will be submitted in a single commit.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107273</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107273"/>
		<updated>2017-03-23T19:53:18Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: /* Tracking issue */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The DOM standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source prototype web browser layout engine being developed by Mozilla, and it is written in [https://www.rust-lang.org/ Rust] language. The main idea is to create a highly parallel environment, in which different components can be handled by fine grained, isolated tasks. The different components can be rendering, HTML parsing, etc. &lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Tracking issue'''==&lt;br /&gt;
The Original Tracking Issue for the project can be found at the [https://github.com/servo/servo/issues/6633 Tracking Issue] page of the [https://github.com/servo/servo/wiki/Mutation-observer-project Mutation Observer Project].&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
*'''Initial steps for Stub method Implementation''':&lt;br /&gt;
**Create the [https://dom.spec.whatwg.org/#mutationobserver MutationObserver] and [https://dom.spec.whatwg.org/#mutationrecord MutationRecord] interfaces with stub method implementations following the guidelines given here: [http://doc.servo.org/script/dom/index.html#adding-a-new-dom-interface Adding a new DOM Interface]&lt;br /&gt;
    '''MutationObserver IDL'''&lt;br /&gt;
    [Constructor(MutationCallback callback)]&lt;br /&gt;
    interface MutationObserver {&lt;br /&gt;
      void observe(Node target, optional MutationObserverInit options);&lt;br /&gt;
      void disconnect();&lt;br /&gt;
      sequence&amp;lt;MutationRecord&amp;gt; takeRecords();&lt;br /&gt;
    };&lt;br /&gt;
    &lt;br /&gt;
    callback MutationCallback  = void (sequence&amp;lt;MutationRecord&amp;gt; mutations, MutationObserver observer);&lt;br /&gt;
    &lt;br /&gt;
    dictionary MutationObserverInit {&lt;br /&gt;
      boolean childList = false;&lt;br /&gt;
      boolean attributes;&lt;br /&gt;
      boolean characterData;&lt;br /&gt;
      boolean subtree = false;&lt;br /&gt;
      boolean attributeOldValue;&lt;br /&gt;
      boolean characterDataOldValue;&lt;br /&gt;
      sequence&amp;lt;DOMString&amp;gt; attributeFilter;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    '''MutationRecord IDL'''&lt;br /&gt;
    [Exposed=Window]&lt;br /&gt;
    interface MutationRecord {&lt;br /&gt;
      readonly attribute DOMString type;&lt;br /&gt;
      [SameObject] readonly attribute Node target;&lt;br /&gt;
      [SameObject] readonly attribute NodeList addedNodes;&lt;br /&gt;
      [SameObject] readonly attribute NodeList removedNodes;&lt;br /&gt;
      readonly attribute Node? previousSibling;&lt;br /&gt;
      readonly attribute Node? nextSibling;&lt;br /&gt;
      readonly attribute DOMString? attributeName;&lt;br /&gt;
      readonly attribute DOMString? attributeNamespace;&lt;br /&gt;
      readonly attribute DOMString? oldValue;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
*Hide the new interfaces by default by adding a &amp;lt;code&amp;gt;[Pref=&amp;quot;dom.mutation_observer.enabled&amp;quot;]&amp;lt;/code&amp;gt; attribute to each one and add a corresponding preference to &amp;lt;code&amp;gt;resources/prefs.json&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
*Add a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects as a member of [https://github.com/servo/servo/blob/3c8daca772aacf59bffdff32b017f8029437a85e/components/script/script_thread.rs#L397 ScriptThread].&lt;br /&gt;
*Implement the &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; constructor, by following the steps given in the [https://dom.spec.whatwg.org/#dom-mutationobserver-mutationobserver DOM Specifications].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
*add a &amp;lt;code&amp;gt;__dir__.ini &amp;lt;/code&amp;gt; file to &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; which enables the new preference by including &amp;lt;code&amp;gt;&amp;quot;prefs: [&amp;quot;dom.mutation_observer.enabled:true&amp;quot;]&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
*Tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
*Run web-platform tests from the root by using the following command &lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
*Update corresponding tests expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
After making our changes, we can create the Mutation Observer Object using the Constructor.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Subsequent Steps'''==&lt;br /&gt;
After completing the above initial steps, we plan on performing the following tasks:&lt;br /&gt;
&lt;br /&gt;
*add support for mutation observer microtasks&lt;br /&gt;
**add a mutation_observer_compound_microtask_queued member to ScriptThread&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask] algorithm by adding a new variant to the [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask] enum for mutation observers&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers] algorithm (ignoring the specific text about &amp;quot;execute a compound microtask&amp;quot;) using the vector of observers previously added to ScriptThread&lt;br /&gt;
*add support for observing specific mutations&lt;br /&gt;
**add a vector of MutationObserver objects to Node&lt;br /&gt;
**implement [https://dom.spec.whatwg.org/#dom-mutationobserver-observe MutationObserver.observe] (step 7 and 8 mean &amp;quot;replace an existing matching entry with the new options, or add a new entry if there is no match&amp;quot;)&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record] algorithm&lt;br /&gt;
**make [https://dom.spec.whatwg.org/#concept-element-attributes-change changing]/[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]/[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]/[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing] an attribute queue a mutation record via [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value], [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute], and [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&lt;br /&gt;
&lt;br /&gt;
=='''Commit Frequency'''==&lt;br /&gt;
As per the guidelines of the Mozilla project, all the changes will be submitted in a single commit.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;br /&gt;
4.    https://github.com/servo/servo &amp;lt;br&amp;gt;&lt;br /&gt;
5.    https://github.com/servo/servo/wiki/Mutation-observer-project &amp;lt;br&amp;gt;&lt;br /&gt;
6.    https://dom.spec.whatwg.org/ &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107268</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107268"/>
		<updated>2017-03-23T19:45:03Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: added more info.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]&amp;lt;/span&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. The DOM standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is an open source prototype web browser layout engine being developed by Mozilla, and it is written in [https://www.rust-lang.org/ Rust] language. The main idea is to create a highly parallel environment, in which different components can be handled by fine grained, isolated tasks. The different components can be rendering, HTML parsing, etc. &lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Tracking issue'''==&lt;br /&gt;
The Original Tracking Issue for the same can be found at the [https://github.com/servo/servo/issues/6633 Tracking Issue] page of the [https://github.com/servo/servo/wiki/Mutation-observer-project Mutation Observer Project].&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
*'''Initial steps for Stub method Implementation''':&lt;br /&gt;
**Create the [https://dom.spec.whatwg.org/#mutationobserver MutationObserver] and [https://dom.spec.whatwg.org/#mutationrecord MutationRecord] interfaces with stub method implementations following the guidelines given here: [http://doc.servo.org/script/dom/index.html#adding-a-new-dom-interface Adding a new DOM Interface]&lt;br /&gt;
    '''MutationObserver IDL'''&lt;br /&gt;
    [Constructor(MutationCallback callback)]&lt;br /&gt;
    interface MutationObserver {&lt;br /&gt;
      void observe(Node target, optional MutationObserverInit options);&lt;br /&gt;
      void disconnect();&lt;br /&gt;
      sequence&amp;lt;MutationRecord&amp;gt; takeRecords();&lt;br /&gt;
    };&lt;br /&gt;
    &lt;br /&gt;
    callback MutationCallback  = void (sequence&amp;lt;MutationRecord&amp;gt; mutations, MutationObserver observer);&lt;br /&gt;
    &lt;br /&gt;
    dictionary MutationObserverInit {&lt;br /&gt;
      boolean childList = false;&lt;br /&gt;
      boolean attributes;&lt;br /&gt;
      boolean characterData;&lt;br /&gt;
      boolean subtree = false;&lt;br /&gt;
      boolean attributeOldValue;&lt;br /&gt;
      boolean characterDataOldValue;&lt;br /&gt;
      sequence&amp;lt;DOMString&amp;gt; attributeFilter;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    '''MutationRecord IDL'''&lt;br /&gt;
    [Exposed=Window]&lt;br /&gt;
    interface MutationRecord {&lt;br /&gt;
      readonly attribute DOMString type;&lt;br /&gt;
      [SameObject] readonly attribute Node target;&lt;br /&gt;
      [SameObject] readonly attribute NodeList addedNodes;&lt;br /&gt;
      [SameObject] readonly attribute NodeList removedNodes;&lt;br /&gt;
      readonly attribute Node? previousSibling;&lt;br /&gt;
      readonly attribute Node? nextSibling;&lt;br /&gt;
      readonly attribute DOMString? attributeName;&lt;br /&gt;
      readonly attribute DOMString? attributeNamespace;&lt;br /&gt;
      readonly attribute DOMString? oldValue;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
*Hide the new interfaces by default by adding a &amp;lt;code&amp;gt;[Pref=&amp;quot;dom.mutation_observer.enabled&amp;quot;]&amp;lt;/code&amp;gt; attribute to each one and add a corresponding preference to &amp;lt;code&amp;gt;resources/prefs.json&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
*Add a vector of &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; objects as a member of [https://github.com/servo/servo/blob/3c8daca772aacf59bffdff32b017f8029437a85e/components/script/script_thread.rs#L397 ScriptThread].&lt;br /&gt;
*Implement the &amp;lt;code&amp;gt;MutationObserver&amp;lt;/code&amp;gt; constructor, by following the steps given in the [https://dom.spec.whatwg.org/#dom-mutationobserver-mutationobserver DOM Specifications].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
*add a &amp;lt;code&amp;gt;__dir__.ini &amp;lt;/code&amp;gt; file to &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; which enables the new preference by including &amp;lt;code&amp;gt;&amp;quot;prefs: [&amp;quot;dom.mutation_observer.enabled:true&amp;quot;]&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
*Tests are present in web-platform-tests directory (i.e &amp;lt;code&amp;gt;.tests/wpt/web-platform-tests/dom/nodes&amp;lt;/code&amp;gt;).&lt;br /&gt;
*Run web-platform tests from the root by using the following command &lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/dom/nodes.&lt;br /&gt;
*Update corresponding tests expectations as per the given [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations guidelines] in &amp;lt;code&amp;gt;tests/wpt/metadata/dom/nodes/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
After making our changes, we can create the Mutation Observer Object using the Constructor.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Subsequent Steps'''==&lt;br /&gt;
After completing the above initial steps, we plan on performing the following tasks:&lt;br /&gt;
&lt;br /&gt;
*add support for mutation observer microtasks&lt;br /&gt;
**add a mutation_observer_compound_microtask_queued member to ScriptThread&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask] algorithm by adding a new variant to the [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask] enum for mutation observers&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers] algorithm (ignoring the specific text about &amp;quot;execute a compound microtask&amp;quot;) using the vector of observers previously added to ScriptThread&lt;br /&gt;
*add support for observing specific mutations&lt;br /&gt;
**add a vector of MutationObserver objects to Node&lt;br /&gt;
**implement [https://dom.spec.whatwg.org/#dom-mutationobserver-observe MutationObserver.observe] (step 7 and 8 mean &amp;quot;replace an existing matching entry with the new options, or add a new entry if there is no match&amp;quot;)&lt;br /&gt;
**implement the [https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record] algorithm&lt;br /&gt;
**make [https://dom.spec.whatwg.org/#concept-element-attributes-change changing]/[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]/[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]/[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing] an attribute queue a mutation record via [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value], [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute], and [https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Implement_the_Mutation_Observer_API_M1702&amp;diff=107030</id>
		<title>CSC/ECE 517 Spring 2017/Implement the Mutation Observer API M1702</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/Implement_the_Mutation_Observer_API_M1702&amp;diff=107030"/>
		<updated>2017-03-22T06:10:32Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: moved CSC/ECE 517 Spring 2017/Implement the Mutation Observer API M1702 to CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API: renamed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API]]&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107029</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107029"/>
		<updated>2017-03-22T06:10:32Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: moved CSC/ECE 517 Spring 2017/Implement the Mutation Observer API M1702 to CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API: renamed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
Servo is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language.Servo uses a variety of back-end implementations for drawing graphics depending on the operating system.One of such back-end is only compatible with Android right now, and we want to extend and refactor that back-end to enable on all Linux systems..&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]Servo is an open source prototype web browser layout engine being developed by Mozilla, and it is written in [https://www.rust-lang.org/ Rust] language. The main idea is to create a highly parallel environment, in which different components can be handled by fine grained, isolated tasks. The different components can be rendering, HTML parsing, etc. &lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Background information'''==&lt;br /&gt;
The DOM standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. The goal of this work is to implement the fundamental pieces required to support this API.&lt;br /&gt;
&lt;br /&gt;
=='''Tracking issue'''==&lt;br /&gt;
The Original Tracking Issue for the same can be found at the [https://github.com/servo/servo/issues/6633 Tracking Issue] page of the [https://github.com/servo/servo/wiki/Mutation-observer-project Mutation Observer Project].&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
*'''Initial steps''':&lt;br /&gt;
**create the MutationObserver and MutationRecord interfaces with stub method implementations&lt;br /&gt;
*** hide the new interfaces by default by adding a [Pref=&amp;quot;dom.mutation_observer.enabled&amp;quot;] attribute to each one and add a corresponding preference to resources/prefs.json&lt;br /&gt;
**add a __dir__.ini file to tests/wpt/metadata/dom/nodes/ which enables the new preference, then run the tests in that directory and update the expected test results.&lt;br /&gt;
**Add a vector of MutationObserver objects as a member of ScriptThread&lt;br /&gt;
**Implement the MutationObserver constructor&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
After making our changes,...TODO&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107028</id>
		<title>CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API&amp;diff=107028"/>
		<updated>2017-03-22T06:09:08Z</updated>

		<summary type="html">&lt;p&gt;Ssrivas8: created the initial page structure and description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' Mutation Observer API Project with SERVO &amp;amp; RUST '''&lt;br /&gt;
&lt;br /&gt;
Servo is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language.Servo uses a variety of back-end implementations for drawing graphics depending on the operating system.One of such back-end is only compatible with Android right now, and we want to extend and refactor that back-end to enable on all Linux systems..&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo]Servo is an open source prototype web browser layout engine being developed by Mozilla, and it is written in [https://www.rust-lang.org/ Rust] language. The main idea is to create a highly parallel environment, in which different components can be handled by fine grained, isolated tasks. The different components can be rendering, HTML parsing, etc. &lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.&lt;br /&gt;
&lt;br /&gt;
=='''Background information'''==&lt;br /&gt;
The DOM standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. The goal of this work is to implement the fundamental pieces required to support this API.&lt;br /&gt;
&lt;br /&gt;
=='''Tracking issue'''==&lt;br /&gt;
The Original Tracking Issue for the same can be found at the [https://github.com/servo/servo/issues/6633 Tracking Issue] page of the [https://github.com/servo/servo/wiki/Mutation-observer-project Mutation Observer Project].&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
*'''Initial steps''':&lt;br /&gt;
**create the MutationObserver and MutationRecord interfaces with stub method implementations&lt;br /&gt;
*** hide the new interfaces by default by adding a [Pref=&amp;quot;dom.mutation_observer.enabled&amp;quot;] attribute to each one and add a corresponding preference to resources/prefs.json&lt;br /&gt;
**add a __dir__.ini file to tests/wpt/metadata/dom/nodes/ which enables the new preference, then run the tests in that directory and update the expected test results.&lt;br /&gt;
**Add a vector of MutationObserver objects as a member of ScriptThread&lt;br /&gt;
**Implement the MutationObserver constructor&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
After making our changes,...TODO&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
1.    https://doc.rust-lang.org/stable/book/&amp;lt;br&amp;gt;&lt;br /&gt;
2.    https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;br&amp;gt;&lt;br /&gt;
3.    https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssrivas8</name></author>
	</entry>
</feed>