Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: capricorn86/happy-dom
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v12.1.1
Choose a base ref
...
head repository: capricorn86/happy-dom
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v12.1.2
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Sep 18, 2023

  1. Copy the full SHA
    bee8bdd View commit details
  2. Merge pull request #1076 from capricorn86/task/653-documentreferrer-s…

    …hould-be-a-string
    
    #653@patch: Adds support for Document.referrer.
    capricorn86 authored Sep 18, 2023
    Copy the full SHA
    a81baba View commit details
1 change: 1 addition & 0 deletions packages/happy-dom/src/nodes/document/Document.ts
Original file line number Diff line number Diff line change
@@ -63,6 +63,7 @@ export default class Document extends Node implements IDocument {
public readonly readyState = DocumentReadyStateEnum.interactive;
public readonly isConnected: boolean = true;
public readonly defaultView: IWindow;
public readonly referrer = '';
public readonly _windowClass: {} | null = null;
public readonly _readyStateManager: DocumentReadyStateManager;
public readonly _children: IHTMLCollection<IElement> = new HTMLCollection<IElement>();
1 change: 1 addition & 0 deletions packages/happy-dom/src/nodes/document/IDocument.ts
Original file line number Diff line number Diff line change
@@ -46,6 +46,7 @@ export default interface IDocument extends IParentNode {
readonly visibilityState: VisibilityStateEnum;
readonly hidden: boolean;
readonly links: IHTMLCollection<IHTMLElement>;
readonly referrer: string;
cookie: string;
title: string;

6 changes: 6 additions & 0 deletions packages/happy-dom/test/nodes/document/Document.test.ts
Original file line number Diff line number Diff line change
@@ -66,6 +66,12 @@ describe('Document', () => {
});
}

describe('get referrer()', () => {
it('Returns empty string.', () => {
expect(document.referrer).toBe('');
});
});

describe('get nodeName()', () => {
it('Returns "#document".', () => {
expect(document.nodeName).toBe('#document');