diff --git a/components/Accordion.jsx b/components/Accordion.jsx
index 493818f..441381e 100644
--- a/components/Accordion.jsx
+++ b/components/Accordion.jsx
@@ -24,10 +24,10 @@ const Accordion = ({ children, title = "More" }) => {
if (!detailsElement.open) {
// 3. Then open it
detailsElement.open = true;
- // 4. and scroll into view and focus
- targetElement.focus();
- targetElement.scrollIntoView({ behavior: "smooth", block: "center" });
}
+ // 4. and scroll into view and focus
+ targetElement.focus();
+ targetElement.scrollIntoView({ behavior: "smooth", block: "center" });
}
}
diff --git a/components/DocWrapper.jsx b/components/DocWrapper.jsx
new file mode 100644
index 0000000..129e5c7
--- /dev/null
+++ b/components/DocWrapper.jsx
@@ -0,0 +1,24 @@
+import React from "react"
+import { useEffect } from "react"
+
+const DocWrapper = ({children})=>{
+
+ useEffect(()=>{
+ let hash = location.hash.substring(1);
+ // Remove scroll restoration when there is a hash of length > 0.
+ if (hash.length!==0 && "scrollRestoration" in history) {
+ history.scrollRestoration = "manual"
+ }
+ // Check if the hash type is a Docusauraus link or a reference link within document.
+ let isDocusaurusLink = (hash.substring(0,4) !== "link")
+ let targetElement;
+ targetElement = document.getElementById(hash)
+ if(!targetElement)return
+ if(isDocusaurusLink)
+ targetElement.scrollIntoView(true)
+ },[])
+
+ return <>{children}>
+}
+
+export default DocWrapper
\ No newline at end of file
diff --git a/components/Link.jsx b/components/Link.jsx
new file mode 100644
index 0000000..a1bd13d
--- /dev/null
+++ b/components/Link.jsx
@@ -0,0 +1,14 @@
+import React from "react"
+
+const Link = ({hash,title}) =>{
+
+ const handleLink=(event)=>{
+ //manually change hash to trigger hashChange event.
+ window.location.hash = "#";
+ window.location.hash = hash;
+ }
+
+ return {title}
+}
+
+export default Link
\ No newline at end of file
diff --git a/docs/create-modify-element.mdx b/docs/create-modify-element.mdx
index 6e29b3b..7d6485a 100644
--- a/docs/create-modify-element.mdx
+++ b/docs/create-modify-element.mdx
@@ -7,7 +7,11 @@ slug: /
import Admonition from "../components/Admonition"
import Accordion from "../components/Accordion"
+import Link from "../components/Link"
import MDN from "../components/MDNBadge"
+import DocWrapper from "../components/DocWrapper"
+
+
:::note DOM interfaces
Every kind of **DOM** node is represented by an interface based on **Node** interface.
@@ -29,7 +33,7 @@ document.querySelector(".not-found"); // null
```
-
+
Besides Document, this method is also available on Element and DocumentFragment.
If you want to look within a specific element, just use ele.querySelector() on the parent element.
If you want to look within a specific fragment, just use df.querySelector() on the parent fragment.
@@ -65,7 +69,7 @@ for (let p of paras) {
}
```
-`querySelectorAll` is also available on Element and DocumentFragment, in the [same way as querySelector](#element-has-qs).
+`querySelectorAll` is also available on Element and DocumentFragment, in the .
@@ -137,7 +141,7 @@ eleDiv.appendChild(eleH1)
then it is removed from its existing parent and then added to the new parent.
-
+
If newNode is a DocumentFragment, then - instead of adding the fragment itself as a child,
the entire content of the fragment is added as children of the parent node.
@@ -222,7 +226,7 @@ This method is used to create a new empty document fragment.
DocumentFragment can be considered to be a off-screen lightweight `document` object.
It is generally used for batching multiple operations - by doing them in the fragment over time and then rendering the whole content to the visible DOM in one shot .
-Because fragment is not rendered, making changes to it doesn't cause any performance impact (no reflow). To **actually "render" the fragment** in the visible document, [use appendChild](#appendChild-documentFragment) or `insertBefore`.
+Because fragment is not rendered, making changes to it doesn't cause any performance impact (no reflow). To **actually "render" the fragment** in the visible document, or `insertBefore`.
```js
let fragment = document.createDocumentFragment()
@@ -243,4 +247,6 @@ outerEle.appendChild(fragment)
--------
-In the next section, we'll see how to read information from a DOM element.
\ No newline at end of file
+In the next section, we'll see how to read information from a DOM element.
+
+
\ No newline at end of file
diff --git a/src/css/custom.css b/src/css/custom.css
index d95ceeb..86277d8 100644
--- a/src/css/custom.css
+++ b/src/css/custom.css
@@ -34,6 +34,14 @@
text-transform: unset;
}
+.navlink{
+ cursor: pointer;
+}
+
+.navlink:hover{
+text-decoration: underline;
+}
+
summary {
cursor: pointer;
}
\ No newline at end of file