BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
c5083357
Commit
c5083357
authored
Mar 10, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix code examples and add code highligth
parent
6b1b616e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
frontend.md
doc/development/frontend.md
+4
-5
No files found.
doc/development/frontend.md
View file @
c5083357
...
...
@@ -291,7 +291,7 @@ When exactly one object is needed for a given task, prefer to define it as a
`class`
rather than as an object literal. Prefer also to explicitly restrict
instantiation, unless flexibility is important (e.g. for testing).
```
```
javascript
// bad
gl
.
MyThing
=
{
...
...
@@ -340,21 +340,20 @@ When writing a class that needs to manipulate the DOM guarantee a container opti
This is useful when we need that class to be instantiated more than once in the same page.
Bad:
```
```
javascript
class
Foo
{
constructor
()
{
document
.
querySelector
(
'.bar'
);
}
}
new
Foo
();
```
Good:
```
```
javascript
class
Foo
{
constructor
(
opts
)
{
document.querySelector(opts.container
);
opts
.
container
.
querySelector
(
'.bar'
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment