Goole Tech Talks "Speed Up Your JavaScript





JavaScript Performance Issues
  • Scope management
    유효범위관리
    • Scope Chains
      유효범위 체인
    • When a Function Executes
      언제 함수를 실행하는가
      • An execution context is created
        컨텍스트가 생성되었을때 실행
      • The context's scope chain is initialized with the members of the function's [[Scope]] collection
        컨텍스트의 범위 체인은 함수의 [[범위]] 컬렉션의 멤버가 초기화됩니다
      • An activation object is created containing all local variables
        활성 개체는 모든 지역 변수를 포함해서 만들어집니다
      • The activation object is pushed to the front of the context's scope chain
        정품 인증 개체 컨텍스트의 범위 체인의 전면에 밀려있다 ???
    • Execution Context
      컨텍스트 실행
      • Identifier Resolution
        식별자 분해
        • Start at scope chain position 0
          범위 체인 위치 0부터 시작
        • If not found go to position 1
          만약 없을 경우 1번으로 간다.
        • Rinse, repeat
          반복
    • Scope Chain Augmentation
      범위 연결 요소(확대?)
      • The with statement
        with 상태
      • The catch clause of try-catch
        try-catch 절을 잡았을때
      • Both add an object to the front of the scope chain
        양쪽 모두 범위 체인의 전면에 개체를 추가
        • Inside of Global Function
          전역함수 내부
        • Inside of with/catch Statement
          with/catch 상태 내부
        • "with statement considered harmful" -Douglas Crockford
          with 상태를 해로운것으로 간주했다. - 더글라스 크록포드
    • Closures
      클로저
      • The [[Scope]] property of closures begins with two objects
        클로저의 [[범위]] 속성이 두 개체로 시작
      • Calling the closure means three objects in the scope chain (minimum)
        폐쇄를 호출하면 범위 체인 (최소) 세 개체를 의미
    • Recommendations
      추천
      • Store out-of-scope variables in local variables
        지역 변수에 저장 밖에서 범위 변수
        • Especially global variables
          특히 전역 변수
      • Avoid the with statement
        with 상태를 피한다.
        • Adds another object to the scope chain, so local function variables are now one step away
          범위 체인에 다른 개체를 추가한다, 그래서 로컬 함수 변수는 이제 한 걸음 거리에 있습니다
        • Use local variables instead
          지역 변수를 대신 사용하라
      • Be careful with try-catch
        try-catch 조심하라
        • The catch clause also augments the scope chain
          cache 조항도 스코프 체인을 증가시키다
      • Use closures sparingly
        클로저를 아껴서 사용하라
      • Don't forget var when declaring variables
        변수를 선언시 var를 잊지 마세요
  • Data access
    데이터 액서스
    • Places to Access Data
      테이스 액서스 장소
      • Literal value
        리터럴 값
      • Variable
        변수
      • Object property
        개체 속성
      • Array item
        배열 항목
    • Data Access Performance
      데이터 액서스 성능
      • Accessing data from a literal or a local variable is fastest
        데이터 액서스는 리터럴, 로컬 변수가 가장 빠른다
        • The difference between literal and local variable is negligible in most cases
          리터럴과 지역 변수의 차이는 대부분의 경우 무시할 수있다
      • Accessing data from an object property or array item is more expensive
        개체 속성 또는 배열 항목이 데이터에 접근이 더 비싸다
        • Which is more expensive depends on the browser
          브라우저에 따라 더 비싼거나 달라집니다
    • Recommendations
      추천
      • Store these in a local variable:
        지역 변수 스토어:
        • Any object property accessed more than once
          한 번 이상 액세스한 어떤 개체 속성
        • Any array item accessed more than once
          두 번 이상 액세스한 모든 배열 항목
      • Minimize deep object property/array item lookup
        깊은 개체 속성 / 배열 항목 조회 최소화
  • Loops
    루프
    • Loops
      푸트
      • ECMA-262, 3rd Edition:
        • for
        • for-in
        • do-while
        • while
      • ECMA-357, 2nd Edition:
        • fro each
    • Which loop?
      어떤 루프
    • It doesn't matter!
      그것 중요한게 아니다
    • What Does Matter?
      문제가 뭔가?
      • Amount of work done per iteration
        반복되는 일은 비용이 든다.
        • Includes terminal condition evaluation and incrementing/decrementing
          터미널 상태 평가가 포함되며 증가/감소
      • Number of iterations
        반복 수
      • These don't vary by loop type
        이것은 루프 타입에 따라 차이 없어
    • Fixing Loops
      고정 루프
      • Decrease amount of work per iteration
        반복 당 작업의 양을 감소
      • Decrease number of iterations
        반복의 수를 줄이십시오
    • Easy Fixes
      쉽게 수정
      • Eliminate object property/array item lookups
        개체 속성 / 배열 항목 조회 제거
      • Combine control condition and control variable change
        제어 조건과 제어 변수 변경 결합
        • Work avoidance!
          일을 회피!
          [code javascript]
          var len = e.length;
          var k = len;
          while(k--){ process(e[k]); }
          [/code]
    • Things to Avoid for Speed
      속도 피하기 위해 상황
      • ECMA-262, 3rd Edition:
        • for-in
      • ECMA-357, 2rd Edition:
        • for each
      • ECMA-262, 5th Edition:
        • array.forEach()
      • Function-based iteration:
        • JQuery.each()
        • Y.each()
        • $each
        • Enumerable.each()
    • [code javascript]
      values.forEach(function(value, index, array){
          process(value)
      });
      [/code]
      • Introduces additional function
        도입 부가 기능
      • Function requires execution (execution context create, destroyed)
        기능 실행 (실행 컨텍스트를 생성, 파괴)가 필요합니다
      • Function also creates additional object in scope chain
        함수는 또한 범위 체인에 추가 개체를 만듭니다
  • DOM
    • HTML Collection Objects
      • Look like arrays, but aren't
        배열처럼 보이지만 아니다
        • Bracket notation
          브래캣 표기법
        • length property
          length 속성
      • Represent the results of a specific query
        특정 쿼리의 결과를 나타낸다
      • The query is re-run each time the object is accessed
        검색어가 다시 개체에 액세스할 때마다 실행됩니다
        • Include accessing length and specific items
          길이와 특정 항목 액세스 포함
        • Much slower than accessing the same on arrays
          대부분 배열에 동일한 액세스보다 느리다
        • Exceptions: Opera, Safari
          예외: 오페라, 사파리

    • [code javascript]
      var items = [{}, {}, {}, {}, {}, {}, {}];
      for (var i=0;  i < items.length; i++){
      }

      var divs = documents.getElementByTagName("div");
      for (var i=0; i < divs.length; i++){
      }
      [/code]
      실행시간 FireFox 15x, Chrome 53x, IE 68x

      [code javascript]
      var items = [{}, {}, {}, {}, {}, {}, {}];
      for (var i=0, len=items.length;  i < len; i++){
      }

      var divs = documents.getElementByTagName("div");
      for (var i=0, len = divs.length; i < len; i++){
      }
      [/code]
      실행시간 FireFox =, Chrome =, IE =
    • HTML Collection Object
      HTML 컬렉션 개체
      • Minimize property access
        최소화 속성 액세스
        • Store length, items in local variables if used frequently
          스토어 길이는 지역 변수의 항목은 자주 사용하는 경우
          [code javascript]
          function array(items){
          try{  return Array.prototype.concat.call(items); }catch(ex){
          var i = 0, len = items.length, result = Array(len); while(i < len){ result[i] = items[i]; i++; } return result;
          }

          }
          [/code]
      • document.images, document.forms, etc.
      • getElementsByTagName()
      • getElementsByClassName()
    • Reflow
      리플로우
      Reflow is the process by which the geometry of the layout engine's formatting objects are computed. - Chris Waterson, Mozilla
      리플로우는 레이아웃 엔진의 포맷 개체의 지오메트리를 계산하는 과정입니다.
    • When Reflow?
      언제 리플로우 하는가?
      • Initial page load
        초기 페이지 로드
      • Browser window resize
        브라우즈 창 크기를 변경
      • DOM nodes added or removed
        DOM 노드 추가 또는 제거
        [code javascript]
        var list = document.getElementById("list");

        for (var i=0; i < 10; i++){
        var item = document.createElement("li"); list.appendChild(item); // reflow
        }
        [/code]
        • DocumentFragment
          문서조각
          • A document-like object
            문서 같은 개체
          • Not visually represented
            시각적으로 보이지 않는다
          • Considered a child of the document from which it was created
            어느것으로부터 만들어진 문서의 자식으로 간주
          • When passed to addChild(), appends all of its children rather than itself
            addChild() 을 전달하면 그 자체보다는 그 아이들이 전부를 추가합니다
        [code javascript]
        var list = document.getElementById("list");
        var fragment = document.createDocumentFragment();

        for (var i=0; i < 10; i++){
        var item = document.createElement("li"); fragment.appendChild(item); // no reflow!
        }

        list.appendChild(fragment); // reflow
        [/code]
      • Layout styles applied
        레이아웃 스타일 적용
        [code javascript]
        element.style.height = "100px"; element.style.display = "block"; element.style.fontSize = "130%";
        [/code]
        [code css]
        .active {
        height: 100px; display: block; font-size: 130%;
        }
        [/code]
        [code javascript]
        element.className = "active";
        [/code]
      • Layout information retrieved
        레이아웃 정보를 검색
    • What to do?
      어떻게해야 하죠?
      • Minimize access to layout information
        레이아웃 정보를 최소화 액세스
      • If a value is used more than once, store in local variable
        두 번 이상 사용하는 경우 값을 로컬 변수에 저장
  • Speed Up Your DOM
    DOM 속도 올려라
    • Be careful using HTML Collection objects.
      HTML을 컬렉션 개체를 사용에 주의하십시오.
    • Perform DOM manipulations off the document
      문서에서 DOM 조작 수행을 하지마세요.
    • Change CSS classes, not CSS styles
      CSS 스타일을 수정하지 말고, CSS 클래스를 변경하세요.
    • Be careful when accessing layout information
      레이아웃 정보를 액세스 할때 조심하세요.
  • Browsers With Optimizing Engines
    • Chrome (V8)
    • Safari 4+ (Nitro)
    • Firefox 3.5+ (TraceMonkey)
    • Opera 10? 11? (Carakan)

      All use native code generation and JIT compiling to achieve faster JavaScript execution.
      모든 네이티브 코드 생성 하여 사용 및  빨리 자바 스크립트 실행을 달성하기 위해 JIT 컴파일.
  • Summary
    개요
    • Mind your scope
      당신의 범위를 확인하라(조심하라)
    • Local variables are your friends
      지역변수는 당신의 친구다
    • Function execution comes at at cost
      함수 실행은 비용이 든다
    • Keep loops small
      루프는 별거아니다
    • Avoid doing work whenever possible
      가능한 일을 피하라 ( 프로그램이 하는 일을 작게 만드라는 의미인가? )
    • Minimize DOM interaction
      DOM 관련 작업은 최소화 하라
    • Use a good browser and encourage others to do the same
      좋은 브라우저를 사용하고 다른 사람들이 같은 행동을 할 것을 권해드립니다
  • Questions?
    • 이후 영어로 된 질문은 영어가 짦아서... ㅡ.ㅡa




저작자 표시 비영리 동일 조건 변경 허락
Posted by 푸른_바람
HTML5 Canvas와 jQuery 등의 JavaScript FrameWork를 이용한 게임개발에 대한 설명과 AVES 엔진에 대한 설명입니다.
도영상 마지막 부분에는 프로토타입으로 만든 게임영상을 볼 수 있군요.

영어를 못하니 대충 지나가는 말중에 10%도 못 알아 먹고, 결국은 PT자료를 보고서 조금 더 이해를 할 수 있었습니다.

** Building a JavaScript-Based Game Engine for the Web
- Paul Bakaus, June 11, 2010, Google

......

* Oh noes! Canvas is a lot slower!
- Canvas image API is pretty inefficient, as it needs as DOM representation of the image first.
- Which means if you're working with lots of graphics. Canvas is actually way slower than generic HTML.

* Block Rendering.

* Block rendering?
- directly replace innerHTML with a huge string instead of multiple DOM append Operations.
- Huge performance boost.
 -- active parsing of HTML engine is really fast.
 -- Reflow and Repaint occur only once.
- Hug disadvantage.
 -- No reference to individual nodes!

* Lazy node linking.
- Fixes the main disadvantage of missing references.
- After innerHTML has been set. run:
- var elements = S('"', container);
- Now you have a collection of all elements!
- Since you know the order of the construction. you can reference back.

* Conservative method.
- Build <div>'s and style them via JavaScript (on the style tag).
- Render them out enbloque through innerHTML.
- Ugh. still kind of slow...
- I want more!
 -- <div style="position: absolute; top: 122px; left: 145px; z-index: 102; background-image: url(house_1.png); margin-top: -10px; margin-left: -10px; background-position: 10px 33px;"></div>

* Web method
- Don't ignore the layout layers.
 -- expecially not external CSS
- Keep the style tag of the <div> Object minimal:
 -- z-index top, left

* What is event delegation?
- A technique to .. forward" events to implicit listeners.
- In web development. usually the following:
 -- Bind an event to the root node except for the actual child element.
 -- When an event happens (i.e. click). find out if the target or an ancestor matches the child element.
 -- Moves processing efforts to when the event happens, scales really well.

* One event to rule them all.
- "???"
 -- Handles position detection. dragging.
- "???"
 -- Handles drag start. clicking.
- "???"
 -- Handles drag stop. clicking.

* Clicking on objects.
- Yay, I can click on houses!
- Mh, I can click on transparency. too...
- This kind of sucks!

* Click through maps.
- Build up a ??? for each object that tells us where the transparent pixels are.
- if transparent, check behind until you find a valid target.
 -- ???
- WOOt. this fixes our issue!

* Building up those pixel maps is amazingly crappy owrk!

* Let Canvas do it!
- Canvas can read pixel data form images.
- then, we can check if our pixel is in fact transparent.
- ...and save this 0/1 value in a new optimized. smaller array.
- ???

* Action surfaces.

* ?
- Basically a droppable for widgets or other objects.
- Transformed to isometric projection in real item using CSS Transforms.
- Way cool!

* CSS Transforms needed
- ???

* Server-side JavaScript

* WTF?!?!
,,JavaScript is painful enough already, now you want me to work with it in the backend as wel?"

* Why JavaScript?
- A single scripting lanauage per project dramatically speeds up development.
- Great portions of client side code (i.e. for calculations) can be reused without costs.
- ???

* JavaScript in the Browser.

* JavaScript in node.

* Node's features.
- Google's V8 engine running on server.
- Server and scripting combined.
- Comes with sugar ( pretty modules for system. servers etc. )
- Everything is non-blocking (file system calls etc.)
- EcmaScript 5

* Modules
- CommonJS module system.
- Very handy for organizing code.
- No way around it in Node.js - without modules. no(useful) app.
- Common modules: sys, fs, http, process.

* The great innovation?

* Node is completely event-driven.
- ???

* Server
- not threaded.
- no multiple processes.
- can serve and thandle a lot more requests at a time.
- eats a lot less memory.

* IO / API
- Accessing external data is always non-blocking.
- You got that right - node.js cat't be stopped easily!

* Hello world in node.js
- ???

* Finally - get rid of limitations.
- ???

* "MMOGs" in browsers.
- almost all games are limited to a couple thousand players per world instance.
- we want real multiplayer!
 -- worlds with millions of players
 -- no (thechnical) fragmentation between worlds.
 -- 200+ characters on a single viewport.

* "AVES" ENGINE

* ?
- Professional game engine for the web.
- Commercially licensable.
- Cross-platform (yes, works on smartphones!)
- Comes with all mentioned features ( and more )
- Currently in alpha.

저작자 표시 비영리 동일 조건 변경 허락
Posted by 푸른_바람
  • Error: 800a03e8 오류가 발생하여 작업을 완료할 수 없습니다.
  • domain.com 인터넷 사이트를 열 수 없습니다.
Window IE8 에서 자주 나타나는 문제인데 해당 문구에 대해서 검색을 해보았습니다.
"Error: 800a03e8"

HTML의 DOM이 모두 로드되기 전에 javascript 가 실행되기 때문에 발생한 문제다. 라고 정의 되어 있습니다.

해결 방법으로는 DOM이 모두 로드되고 난 후에 javascript가 실행되도록 script를 수정해야 한다네요.

그외 DOMREADY 라는 도구가 있습니다. 
<html lang="en">
 <head>
	 <script src="domready.js" type="application/javascript"></script>
	 <script type="application/javascript">
		 DomReady.ready(function() {
		     alert('dom is ready');
		 });
	 </script>
 </head>
 <body>

 </body>
 </html> 
위 방법으로 DOM이 모두 로드되고 난 뒤에 스크립트를 실행이 되도록 js를 개발하면 문제가 없다는건데요.

제가 사용중인 jquery.js에서는 
jQuery(document).ready(function(){ });

일반 js에서는 (function() {}); 를 사용하면 될것 같습니다.

현재 서비스에서 (function() {}); 를 적용하니 문제가 없어졌습니다.

하지만 이런 방법을 사용해도 문제가 된다면 디버깅하기가 힘들어 질거 같네요. ㅡ.ㅡ
저작자 표시 비영리 동일 조건 변경 허락
Posted by 푸른_바람
TAG DOM, javascript, JS
현재는 IE8 이하에서 html5 태크를 인식시키기 위해서 아래 스크립트 코드를 사용중입니다.
<!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->

위 스크립트 코드를 사용했을 경우 일반적인 HTML 페이지에서는 아무런 문제없이 HTML5 태그 사용이 가능해집니다. 
간혹 CSS 렌더링에서 기타 다른 브라우저와 다른결과가 나오긴 하지만 그것 역시도 {display: block;} 을 지정하면 문제없이 거의 동일한 결과로 나타납니다.

header, section, aside, article, footer { display: block; }

하지만 위 문제중 HTML5 태그를 ajax.load() 형식으로 불러올 경우 IE8에서는 HTML5 태그를 제대로 인식 하지 못하는것 같습니다.

아래 그림은 HTML페이지로 접근했을 경우 IE8이 파싱한 결과입니다.
아래는 ajax로 해당 컨텐츠를 로딩했을 경우 IE8에서 파싱한 결과입니다.

문제는 class="listconwrap" 으로 CSS가 적용이 되어야 하지만 IE8에서는 XHTML으로 인식하는지, 혹은 HTML5 DOCTYPE 에 문제가 있는지, 아니면 IE8에서 태그리스트에 등록이 안되어 있는 태그라서 그런지 내용이 없는 태그로 인식하고 닫는태그로 자동으로 닫아 버립니다. 그러니 CSS class 적용이 무용지물이 되어버리는군요.

위 문제를 해결할 수 있는 방법이 없는지 찾아보고는 있지만 아직 이렇다할게 없네요.

저작자 표시 비영리 동일 조건 변경 허락
Posted by 푸른_바람

Web Style Sheets
CSS tips & tricks

[code css]
tr:nth-child(even) {background: #CCC}
tr:nth-child(odd) {background: #FFF}
[/code]


[code css]
col:first-child {background: #FF0}
col:nth-child(2n+3) {background: #CCC}
[/code]

IE는 아직 안된다는... :(
Posted by 푸른_바람

w3m은 lynx와 같은 텍스트 브라우저 이지만 lynx보다는 훨씬 세련되었다. lynx는 매우 가볍고 빠르며 필요한 텍스트 정보만을 보여주므로 컨텐츠에 집중할 수 있게 도와주기는 하지만 사이트가 약간만 복잡해지면 브라우징 하기가 매우 어려워 진다는 단점을 가지게 된다. 프레임이 사용되거나 조금 복잡한 테이블이 사용되면 어디가 어디인지 도통 감을 잡을 수 없다. 정보에 대한 가독성을 높이기 위해서는 필요한 텍스트만 얻어내는 것도 중요하지만 시각적으로 보기 쉽게 정보를 보여줄수 있어야 하며 사용자 친화적인 인터페이스를 제공할 수 있어야 한다.. lynx는 시각적인 면과 편리한 인터페이스를 충족시키지 못한다. w3m은 이를테면 필요한 정보로의 집중 빠른 정보접근 시각적인면과 편리한 인터페이스를 모두 충족시킬 수 있는 매우 훌륭한 텍스트 기반 브라우저이다. 특히 정보수집을 목적으로 웹서핑을 하길 원한다면 w3m보다 훌륭한 브라우저가 없다고 감히 주장한다. 개인적으로도 컨텐츠 관리를 위한 웹서핑은 w3m을 사용한다. 특히 textarea 에서 vim을 불러와서 문서편집이 가능하다는게 정말 맘에 든다.

w3m 으로 http://mypickup.kr 서핑~

CSS가 적용되지 않은 관계로 리스트형식으로 보인다.

페이지/커서 이동 관련 단축키

SPC,+,C-v다음 페이지로 이동
ESC-v이전 페이지로 이동
l커서를 오른쪽으로 이동
h커서를 왼쪽으로 이동
j커서를 아래로 이동
k커서를 위로 이동
K한줄씩 위로 스크롤
J한줄씩 아래로 스크롤
<화면을 왼쪽으로
>화면을 오른쪽으로
,화면을 한 열씩 왼쪽으로
.화면을 한 열씩 오른쪽으로
^줄의 처음으로
$줄의 마지막으로
G지정한 줄번호로 이동
숫자+G숫자 라인으로 이동
w다음 단어로 이동
W이전 단어로 이동
[첫번째 링크로
]마지막 링크로
DOWN,C-n,TAB다음 링크로
UP,C-p,C-u이전 링크로
ESC-m전체 링크 목록

하이퍼링크 관련

C-f,C-j,C-m,RIGHT링크페이지로 이동
d, ESC-C-j,ESC-C-m링크를 파일로 저장
I이미지 보기
ESC-I이미지를 파일로 저장
c현재 URL 출력
u링크 URL출력
i이미지 URL출력
=현재 페이지 정보
C-g라인번호 출력
L모든 링크와 이미지의 목록 출력


추가 기능은 리눅스용 텍스트 브라우저 W3m 사용기 에 자세히 소개 되어있습니다. ^^

'IT > HTML+JS+CSS+' 카테고리의 다른 글

IE html5 파싱문제  (0) 2011/01/13
CSS odd & even rules  (0) 2010/08/11
리눅스용 텍스트 브라우즈 w3m  (0) 2010/08/05
URI와 링크  (0) 2009/04/25
블록 레벨 요소(block-level elements)  (0) 2009/04/24
네비게이션 링크  (0) 2009/04/24
Posted by 푸른_바람
2009/04/25 12:07
* URI와 링크
 - 웹에서 다양한 페이지를 오갈 수 잇는 이유는 페이지들이 URI를 기본으로한 '링크'로 연결되어 있기 때문이다.

** URI 스킴(URI schmes)
 - http://www.iana.org/assignments/uri-schemes.html
 - RFC 3986 'Uniform Resource Identifier (URI):  Generic Syntax
  -- http://www.ietf.org/rfc/rfc3986.txt
 - W3C 주석 'URIs, URLs, and URNs : Clarifications and Recommendations 1.0'
  -- http://www.w3.org/TR/uri-clarification
 - 보통의 웹 페이지는 http: 스킴을 이용
 - FTP서버에 접근하기 위한 ftp: 스킴, 이메일 조주소를 지정하기 위한 mailto: 스킴 등 IANA 'Uniform Resource Identifier(URI) Schemes'에는 gopher: 스킴 news: 스킴등 40종류 이상의 공식 URI스킴이 등록되어있다.
 - http: 스킴 서식은 RFC 1738과 RFC 2396 등에서 아래와 같이 규정 되어있다.
  -- http://<authority><path>
  -- http://<authority><path>?<query>
  -- http://<authority><path>#<fragment>
  -- 규정 다음으로 '?'로 구별되는 쿼리부분(query component)과 '#'로 구별되는 프래그먼트 식별자(Fragment Identifier)를 지정할 수 있다.

*** 책임자 부분(authorigy component)
 - '//' 네트워크상의 리소스임을 나타낸다.
 - 끝 부분 ':'  서버의 포트번호를 지정
 - 책임자 부분에는 알파벳 또는 -(하이폰)만 사용할 수 있다

*** 패스 부분(path component)
 - 폴더명과 파일부분으로 구성된다.
 - 서버 내부 자원의 위치를 나타낸다.
 - 임의로 이름을 붙일 수 잇다.
 - 폴더 계층은 '/'로 구별 규정.
 - '.html'은 '확장자'라 하며 그 자원이 (X)HTML 형식으로 작성, 보존되었음((X)HTML 문서임)을 의미한다.
 - '.html' 이외에 '.htm'이 사용되기도 한다.

** 절대 URI
 - URI를 URI스킴에서 패스까지 전부 적는 것을 말하며 웹 전체에서 본 URI이다.
 - 일반적으로 URI라 하면 절대URI를 가르킨다.
 - 일반적으로 URI에서 파일명이 생략된 경우 'index.html'(또는 'index.htm', IIS에서는 'default.html")이 기본파일로 설정되어 있다.
 - Apache 서버라면 .htaccess파일에 다음과 같이 설정하여 파일의 기본값(단일, 복수)을 지정할 수 있다.
  -- DirectoryIndex top.html
  -- DirectoryIndx index.html index.cgi index.php
 - URI가 폴더명으로 끝날경우 '/'를 확실히 붙여야 한다.

** 상대 RUI
 - 어떤 파일과 폴더를 기저믕로 하는 다른 파일과의 경로.
 - 같은 폴더안의 파일을 참고할 경우
  -- ./site.html
  -- site.html
 - 한단계 위 폴더의 파일을 참조
  -- ../reports/index.html
  -- '..'는 한 단계 위를 나타낸다.

'IT > HTML+JS+CSS+' 카테고리의 다른 글

CSS odd & even rules  (0) 2010/08/11
리눅스용 텍스트 브라우즈 w3m  (0) 2010/08/05
URI와 링크  (0) 2009/04/25
블록 레벨 요소(block-level elements)  (0) 2009/04/24
네비게이션 링크  (0) 2009/04/24
XHTML BASE  (0) 2009/04/24
Posted by 푸른_바람
* 블록 레벨 요소(block-level elements)
 - 한개의 독립된 덩어리'라는 의미
 - 제목(h1~h6)
 - 문단(p 요소)
 - 작성자 정보(address 요소)
 -

'IT > HTML+JS+CSS+' 카테고리의 다른 글

리눅스용 텍스트 브라우즈 w3m  (0) 2010/08/05
URI와 링크  (0) 2009/04/25
블록 레벨 요소(block-level elements)  (0) 2009/04/24
네비게이션 링크  (0) 2009/04/24
XHTML BASE  (0) 2009/04/24
META TAG  (0) 2009/04/24
Posted by 푸른_바람
* 네비게이션 링크
 - 복수 페이지 사이의 관계를 링크로 표시하는 기능
 - 네비게이션 링크를 확실하게 지정하면 사이트에서 이동이 편리해지고 사용성이 향상된다.
 - WCAG1.0에서도 '우선도2'로 네비게이션 링크를 지정하게 규정하고 있다.

[code html]
<head>
 <metahttp-equiv="Content-type" contents="applicatioin/xhtml+xml; charset=UTF-8" />
 <title>웹 구조의 이해</title>
 <meta name="description" content="HTML,HTTP,URI등의 웹의 기본적인 구조와 URI의 구조를 설명." />
 <meta name="keyword" content="Web,WWW,구조,HTML,hTTP,URI,링크" />
 <link rel="contents" href="/index.html" title="차례" />
 <link rel="glossary" href="/glossary" title="용어집" />
 <link rel="help" href="/about/help.html" title="도움말" />
</head>
[/code]

* rel속성값 및 내용
  • - start : 시작페이지
  • - next : 다음페이지
  • - prev : 이전페이지
  • - contents : 차례
  • - index : 찾아보기
  • - glossary : 용어집
  • - copyright : 저작권보호
  • - chapter : 장
  • - sectioin : 절
  • - subsecton : 항
  • - appendix  : 부록
  • - help : 도움말
  • - bookmark : 즐겨찾기

** link 요소로 대체문서를 지정
- 대체문서 지정, 다른어어버전 표시 및 media 속성을 지정하면 다른 미디어에 적용할 버전을 표시할 수 있다.

[code html]
<link rel="alternate" href="./english.html" hreflan="en-us" />
<link ref="alternate" href="./imple.html" media="pring" />
[/code]

** link 요소로 외부 스타일시트를 지정
[code html]
<link rel="stylesheet" type="text/css" media="screen" href="./css/default.css" />
<link ref="stylesheet" type="text/css" media="print" href="./css/print.css" />
[/code]

** link 요소로 작성자 지정
- rel 속성이 아니라 rev속성 지정은 그 페이지에서 봤을 때 작성자는 객체가 되기 때문이다. rel속성은 링크와 관계가 '주체' rev 속성은 링크와의 관계가 '객체'라는 차이가 있다.

[code html]
<link rev="made" href=mailto:webmaster@w3.org />
[/code]






'IT > HTML+JS+CSS+' 카테고리의 다른 글

URI와 링크  (0) 2009/04/25
블록 레벨 요소(block-level elements)  (0) 2009/04/24
네비게이션 링크  (0) 2009/04/24
XHTML BASE  (0) 2009/04/24
META TAG  (0) 2009/04/24
네임스페이스와 언어코드  (0) 2009/04/24
Posted by 푸른_바람
2009/04/24 18:09
* XHTML BASE (XHTML2.0 초안)

** HTML
 - <base href="http://www.w3.org/" />

** XHTML
 - <html xml:base=http://www.w3.org/" />

- W3C권고 "XML base"
  -- http://www.w3.org/TR/xmlbase/

'IT > HTML+JS+CSS+' 카테고리의 다른 글

블록 레벨 요소(block-level elements)  (0) 2009/04/24
네비게이션 링크  (0) 2009/04/24
XHTML BASE  (0) 2009/04/24
META TAG  (0) 2009/04/24
네임스페이스와 언어코드  (0) 2009/04/24
웹 접근성  (0) 2009/04/24
Posted by 푸른_바람
이전버튼 1 2 3 4 5 ... 8 이전버튼