Questions tagged [stack-snippets]
Stack Snippets are runnable code sandboxes of the front-end languages HTML, CSS, and JS for use within a Stack Exchange post. Use this tag for bug reports, feature requests, and discussions explicitly relevant to these snippets and their underlying technologies.
473
questions
-11
votes
1
answer
165
views
Do I need to put onloads and main elements in code snippets? [duplicate]
RELATED: Allow us to choose a doctype for Stack Snippets
I can put this in a code snippet:
$("#box").css("color", "red");
<div id="box">Hello, World!</div>
I can also do this:
...
24
votes
0
answers
249
views
'run code snippet' buttons misaligned
I was looking at an answer that had a 'run code snippet' section, and the buttons below it look misaligned - the 'copy snippet to answer' button is higher than the 'run code snippet' button by 1 pixel....
9
votes
0
answers
214
views
Why can't I "Full page" a js/html/css snippet in a new tab?
At the bottom of javascript/html/css code snippets, when clicking Full page, the current page is simply replaced with the full screen result of the snippet; and no way to get back to the post.
...
7
votes
0
answers
196
views
Snippet console logging JavaScript exception as empty object when using .log
When a JavaScript exception is caught in a snippet and the exception is output using console.log, it appears as an empty object.
Example:
try {
let foo = null;
foo.bar;
} catch(exception) ...
3
votes
0
answers
82
views
Is it practical to have a Google Maps API key available for snippets?
I was wondering, if we can import several libraries in HTML5 snippets like jQuery or AngularJS, would it be possible to be able to use APIs like Google Maps that require an API key, but without having ...
0
votes
2
answers
104
views
Why do images from Dropbox not load when running stack snippets?
*{
padding: 0;
margin: 0;
text-decoration: none;
}
#head{
width: 600px;
height: 40px;
border: 1px solid red;
margin: 0 auto;
line-height: 40px;
font-size:...
5
votes
1
answer
1k
views
Snippet produces "Error: Permission denied to access property Symbol.toPrimitive"
A snippet I posted just now gives me this error in Firefox when I invoke a JavaScript function (by clicking the checkbox):
"message": "Error: Permission denied to access property Symbol.toPrimitive"...
3
votes
0
answers
56
views
`this` variable prints weirdly when using JS snippets
Inspired from a SO question I noticed that the snippets code console.logs this weirdly in the following scenario:
function hello() {
console.log('hello this is', this);
}
hello.call(5);
...
9
votes
1
answer
289
views
Should we edit questions'/answers' code into HTML/CSS/JS snippet, when it doesn't work?
Let's say that there is existing issue with the web code and OP is trying to describe the problem. He enters code for JS/HTML/CSS file as 3 separate code blocks (sometimes more).
Examples:
show ...
29
votes
1
answer
707
views
How to use "code snippet" vs "code block"
Why I ask
In my work to improve questions by editing I often stumble over people who ask questions with code snippets in them. This by itself isn't a problem, since code snippets are a valid ...
3
votes
0
answers
54
views
Minor syntax highlighting error in stack-snippet
I have a screen shot of a coding in stack-snippet from this question, the snippet has no problem when executed but the syntax highlighting is a bit buggy, in the screenshot, there is a variable quote ...
4
votes
0
answers
33
views
Alert question status change inside code snippet
Every now and then, I've been frustrated when encountering a close questions after I finish writing a code snippet.
I've been coding inside a code snippet, trying to solve x problem. I finallly ...
12
votes
1
answer
407
views
Stack Snippets Is Down Again
https://stacksnippets.net/ is returning:
500 - Internal server error. There is a problem with the resource you
are looking for, and it cannot be displayed.
Test:
Hello World
3
votes
0
answers
78
views
Code Snippets: Tooltip text is overlapped by code section
In my recent observation, I saw that the tooltip text for checkbox info icons are being hidden behind the code section.
28
votes
1
answer
338
views
Tidy doesn't fix indentation of <option> and </select> tags
I enter the following in the HTML box of a stack snippet:
<div>
<select>
<option></option>
</select>
</...
16
votes
1
answer
181
views
Stack Snippets Appears to be Down
When running a snippet I am getting:
Server Error in '/' Application. Runtime Error Description: An
application error occurred on the server. The current custom error
settings for this ...
6
votes
1
answer
302
views
automatic code snippet transformation with no reason [edit abusing]
There is a lot of questions dealing about how code snippet aren't well used and in many cases, users are abusing of them thinking they may add value to their question. Here is some of them:
Abusing ...
31
votes
0
answers
390
views
Update for: Help > How do I ask a good question
This is the help topic I am referring to: https://stackoverflow.com/help/how-to-ask.
It states:
If it is possible to create a live example of the problem that you can link to (for example, on ...
2
votes
1
answer
159
views
HTML/JS/CSS auto-surround?
This post is related to two older posts. One is an old feature request, Promote Stack Overflow HTML, JS, CSS Stack Snippets, which did not receive much attention but I think is good. The second is a ...
-21
votes
1
answer
188
views
Discussion about JavaScript snippet compilation [closed]
let and const do not allow duplicate declaration.
Currently this below snippet throwsone (first) error for let. But I am expecting it should be throwing two (for let and const) errors instead of ...
15
votes
0
answers
145
views
Update CDN resources [duplicate]
The CDN options in the select (left-hand) from were we can pick up a resource reference when making a a snippet are very outdated.
For instance: AngularJS (one of the most I use) contains from ...
50
votes
4
answers
1k
views
Code snippets are not runnable on the Stack Overflow mobile website
Code snippets are shown as "code blocks", but without the Run button on mobile devices. (e.g. on Chrome / Android phone).
It would sometimes be very useful to be able to run code snippets on ...
1
vote
0
answers
135
views
Hide code in a snippet that helps display but isn't relevant to the question [duplicate]
I wrote this snippet today. The last line of HTML is styling info that makes the presented result clearer, but isn't actually relevant to the question.
.tags {
position: relative;
}
.tags:...
7
votes
0
answers
284
views
Using CKEditor in a code snippet results in an error
Was trying to write a snippet to demonstrate something with ckeditor today and encountered this message:
{
"message": "SecurityError: Permission denied to access property \"document\" on cross-...
6
votes
1
answer
682
views
Code snippet gives "Script error." message
Today when I tried to answer a question with a snippet it gave me a strange "Script error." message. I can run the sample code and it works, but I still get the error. Is this a bug or am I not ...
5
votes
0
answers
220
views
Stack snippets above a linked answer push the answer out of view
Not sure how butt-burningly important this is but I've noticed that if you click on a linked answer such as mine then the Stack Snippeted answers above the linked answer end up pushing the linked ...
33
votes
1
answer
1k
views
Stack Overflow reputation and profile link in email sign
I wonder if there is a Stack Overflow snippet to add my reputation and link to my profile to use as a signature for my email account.
Does it make sense?
2
votes
2
answers
209
views
Why is JSFiddle used so much among questions and answers?
I was just curious: why do we use JSFiddle within questions and answers, as it is a 3rd party website?
Does anybody have an update on this?
50
votes
2
answers
1k
views
Stack Snippets logging nested objects weirdly
Now that @canon has (more than) fixed the issues, I'm updating this question from a bug report to a feature-request:
Please update the stack snippets console code.
The current version of the stack ...
28
votes
2
answers
719
views
Handle infinite loops, etc. in runnable code snippets
While putting together a JavaScript example for a question in the snippet editor, I made a programming error that caused the page to become unresponsive. (I think I had an event that just kept firing.)...
0
votes
1
answer
82
views
Return to answer after expanding a code snippet does not work properly
I noticed a bug when you are using a code snippet's (aka "Stack Snippets") full page view (like here). You cannot navigate back by using the browser button, and a custom link does not work as expected....
10
votes
2
answers
350
views
Stack Overflow's snippet giving wrong results
Have a look at this answer. Run the snippet and observe the results in snippet's console. Now, find the same code in JSFiddle, run it, and observe the results in your browser's console.
I can't ...
9
votes
1
answer
280
views
Is it possible to change formatting of console logs for JavaScript snippets? [closed]
Recently I was going to answer a JavaScript question. To prove my answer correctness, I inserted a code snippet that processed results and printed into console logs, something similar like:
var ...
3
votes
0
answers
59
views
Autocompletion of usernames when replying to comments on mobile website (Chrome Android)
When replying to a comment on desktop, one can write @Fir and have an autocompletion of usernames in the discussion that begin by Fir. Then we can either do TAB or click on the suggested username to ...
5
votes
0
answers
52
views
Using Tidy on JSX produces incorrectly formatted code
I'm active in the reactjs tag and really like the ability to create runnable React snippets with the Use BabelJS/ES2015 option.
However, when tidy is run on a snippet containing JSX code it produces ...
169
votes
1
answer
29k
views
I've been told to create a "runnable" example with "Stack Snippets". How do I do that?
Sometimes when asking a question or posting an answer related to HTML, CSS, and/or JavaScript, I've been told to create a minimal, complete, and verifiable example using Stack Snippets. How do I do ...
0
votes
1
answer
161
views
Stack-snippet breaks due to HTML syntax issue
I recently came across this surprising issue with Stack-Snippets.
The snippet below is a perfectly normal scenario where the syntax of both
HTML and JavaScript is correct, and it runs as expected.
...
85
votes
2
answers
2k
views
Set CORS on i.stack.imgur.com, to allow for concise snippets
Update: A similar request was posted on MetaSE two years ago, but still has no official response.
Researching a potential answer for a <canvas> question, I ran into a problem that breaks the ...
2
votes
1
answer
90
views
Copy snippet to answer doesn't really copy the code into the snippet
So I just noticed this, When I click on 'Copy snippet to answer' it does copy the code into the answer textarea box. However, it doesn't really copy the code inside the snippet itself. So if I were to ...
-24
votes
1
answer
718
views
Snippet execution for Java code on Stack Overflow
Java 9 introduced the jshell command line tool for REPL and its API - jdk.jshell.
Using the APIs integrated with Stack Overflow, it seems pretty feasible to execute Java snippets as good as ...
2
votes
0
answers
46
views
Tooltip Hidden in Code section of Ask Question page
In chrome version:62.0.3202.62, zoom is 100%, Tooltip in code section of ask question page is hidden behind the content area.
Here is the screenshot for your reference, how to fix this issue??
18
votes
1
answer
691
views
Is it possible to link directly to a full-screen code snippet?
This answer is a thing of beauty. I want to share it far and wide, but I can't figure out how to link directly to the snippet in full screen mode. The helpful "Expand Snippet" button is great and ...
8
votes
1
answer
239
views
stacksnippets error when reading uploaded directories
What causes
"DOMException: A URI supplied to the API was malformed, or the resulting Data URL has exceeded the URL length limitations for Data URLs."
at snippet-javascript-console.min.js?
Minimal,...
5
votes
0
answers
63
views
Stack-snippets editor vs standard editor
When asking/answering questions there is often an issue when indenting code thats not necessarily runnable in the standard editor. Pressing the tab key simply tabs to the next control on the form.
...
18
votes
1
answer
530
views
How to make a working snippet with a library not available in HTTPS?
Since Stack Overflow is in HTTPS, I suppose a lot of snippets are not working anymore and returning a "Mixed Content" error.
I have this issue with one of my answers: Skipping null values with Morris....
28
votes
0
answers
426
views
Can we get React v16 as an option in Code Snippets?
A few weeks ago the first stable version of React v16, also known as React Fiber was released. This is a complete re-write of the core React architecture.
While React v16 and preceeding versions are ...
2
votes
0
answers
44
views
Code snippet save button should have a different label when updating
When working on a code snippet, a button labelled Save & insert into post is shown on the top-left side.
I think this label is fine for creating a code snippet that hasn't been inserted into a ...
4
votes
1
answer
164
views
Is there a way to run a PHP file from our domain with AJAX on Stack Snippets?
Is there an (easy) way to go around the cross-origin restriction in order to get an AJAX example to work in a Stack Snippet? Or alternatively, a way to upload on Stack Snippet, the php file we want to ...
4
votes
0
answers
141
views
Security error when executing same snippet more than one time
Today I noticed an error on one snippet saying
Error : Error executing AG js: SecurityError: Failed to read the 'sessionStorage' property from 'Window': The document is sandboxed and lacks the 'allow-...
6
votes
1
answer
107
views
Insert inline code snippet has weird formatting when putting giant SVG path in HTML box
I was working on an answer and notice when I copy pasted the SVG code for an answer, the formatting completely barfed. I imagine it has to do with the fact that the SVG path code is just really really ...