Unverified Commit 97460433 authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

Fix IE11 CSS Compatibility (#16336)

parent 25fa1653
...@@ -648,7 +648,7 @@ async function doRender({ ...@@ -648,7 +648,7 @@ async function doRender({
;([].slice.call( ;([].slice.call(
document.querySelectorAll('link[data-n-staging]') document.querySelectorAll('link[data-n-staging]')
) as HTMLLinkElement[]).forEach((el) => { ) as HTMLLinkElement[]).forEach((el) => {
el.remove() el.parentNode!.removeChild(el)
}) })
} }
renderPromise.catch((abortError) => { renderPromise.catch((abortError) => {
...@@ -668,7 +668,7 @@ async function doRender({ ...@@ -668,7 +668,7 @@ async function doRender({
// Remove old stylesheets: // Remove old stylesheets:
;([].slice.call( ;([].slice.call(
document.querySelectorAll('link[data-n-p]') document.querySelectorAll('link[data-n-p]')
) as HTMLLinkElement[]).forEach((el) => el.remove()) ) as HTMLLinkElement[]).forEach((el) => el.parentNode!.removeChild(el))
// Activate new stylesheets: // Activate new stylesheets:
;[].slice ;[].slice
......
import Link from 'next/link'
const Page = ({ from }) => (
<div>
<p>{from}</p>
<Link href="/css-modules">
<a>Page with CSS</a>
</Link>
</div>
)
Page.getInitialProps = () => {
return { from: typeof window === 'undefined' ? 'server' : 'client' }
}
export default Page
...@@ -3,5 +3,6 @@ import Logo from '../components/logo' ...@@ -3,5 +3,6 @@ import Logo from '../components/logo'
export default () => ( export default () => (
<div> <div>
<Logo /> <Logo />
<input />
</div> </div>
) )
...@@ -417,6 +417,23 @@ describe('Production Usage', () => { ...@@ -417,6 +417,23 @@ describe('Production Usage', () => {
expect(newText).toBe('server') expect(newText).toBe('server')
}) })
it('should navigate to page with CSS and back', async () => {
const browser = await webdriver(appPort, '/css-and-back')
const initialText = await browser.elementByCss('p').text()
expect(initialText).toBe('server')
await browser
.elementByCss('a')
.click()
.waitForElementByCss('input')
.back()
.waitForElementByCss('p')
await waitFor(1000)
const newText = await browser.elementByCss('p').text()
expect(newText).toBe('client')
})
it('should navigate to external site and back (with query)', async () => { it('should navigate to external site and back (with query)', async () => {
const browser = await webdriver(appPort, '/external-and-back?hello=world') const browser = await webdriver(appPort, '/external-and-back?hello=world')
const initialText = await browser.elementByCss('p').text() const initialText = await browser.elementByCss('p').text()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment