Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not display "<" less than or ">" greater than signs within html. #27

Open
mjdargen opened this issue Oct 12, 2022 · 0 comments
Open

Comments

@mjdargen
Copy link

The code needs to be slightly modified to appropriately display "<" less than or ">" greater than signs within the HTML. This issue seems to impact a few of the String exercises. The tests work properly; however, the example results do not appear correctly and can confuse folks. See the following string exercises:

makeTags: https://the-winter.github.io/codingjs/exercise.html?name=makeTags&title=String-1
Appears like:

makeOutWord('<<>>', 'Yay') → <>
makeOutWord('<<>>', 'WooHoo') → <>
makeOutWord('[[]]', 'word') → [[word]]

Should appear like:

makeOutWord("<<>>", "Yay") → "<<Yay>>"
makeOutWord("<<>>", "WooHoo") → "<<WooHoo>>"
makeOutWord("[[]]", "word") → "[[word]]"

makeOutWord: https://the-winter.github.io/codingjs/exercise.html?name=makeOutWord&title=String-1
Appears like:

makeTags('i', 'Yay') → Yay
makeTags('i', 'Hello') → Hello
makeTags('cite', 'Yay') → Yay

Should appear like:

makeTags("i", "Yay") → "<i>Yay</i>"
makeTags("i", "Hello") → "<i>Hello</i>"
makeTags("cite", "Yay") → "<cite>Yay</cite>"

To fix this, I would set these values equal to .textContent as opposed to .innerHTML. Or you could do a replace with HTML entities: .replace('<','&lt;').replace('>','&gt;')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant