From c2b0731d6dff875c33e8cb4d2af13e290bad44bc Mon Sep 17 00:00:00 2001 From: Hamish Willee Date: Fri, 20 Sep 2024 14:39:43 +1000 Subject: [PATCH] Fix up line numbers etc --- .../columnnumber/index.md | 17 ++++++++++---- .../linenumber/index.md | 23 +++++++++++-------- .../sourcefile/index.md | 19 ++++++++++----- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/files/en-us/web/api/cspviolationreportbody/columnnumber/index.md b/files/en-us/web/api/cspviolationreportbody/columnnumber/index.md index 7e5cc75762d3fc6..69886fe4b1da743 100644 --- a/files/en-us/web/api/cspviolationreportbody/columnnumber/index.md +++ b/files/en-us/web/api/cspviolationreportbody/columnnumber/index.md @@ -83,23 +83,30 @@ Note that while there might be multiple reports in the returned array, for brevi #### Results -If serving the above code using a local server (on `http://127.0.0.1:9999/`), the output of the log on Chrome is: +You can try this out using a [local server](/en-US/docs/Learn/Common_questions/Tools_and_setup/set_up_a_local_testing_server). +Copy the above code into `test/index.html` and `test/main.js` and run the server in the root directory. +Assuming the address of the local server is `http://127.0.0.1:9999`, you can then load the HTML file from `http://127.0.0.1:9999/test/` (or `http://127.0.0.1:9999/test/index.html`). + +With the above setup, the output of the log on Chrome is: ```plain sourceFile: http://127.0.0.1:9999/test/ -lineNumber: 17 +lineNumber: 15 columnNumber: 0 ``` -Note that the column number is (incorrectly) set to `0`. -The result is similar for Firefox, which correctly reports the `columnNumber`. +The result is similar for Firefox: ```plain sourceFile: http://127.0.0.1:9999/test/ -lineNumber: 17 +lineNumber: 15 columnNumber: 13 ``` +Note that the column number is different for the two browsers. +Chrome always appears to report `0`. +The value on Firefox appears to point to the second character after the end of the opening `