This commit is contained in:
Kovid Goyal 2012-01-05 23:37:30 +05:30
parent d72445d70f
commit 2dba4bfa0f
4 changed files with 11 additions and 2 deletions

View File

@ -260,7 +260,7 @@ class CanonicalFragmentIdentifier
index |= 1 # Increment index by 1 if it is even index |= 1 # Increment index by 1 if it is even
if child.nodeType == 1 if child.nodeType == 1
index++ index++
if ( index == target ) if index == target
cfi = cfi.substr(r[0].length) cfi = cfi.substr(r[0].length)
node = child node = child
if assertion and node.id != assertion if assertion and node.id != assertion

View File

@ -31,6 +31,7 @@
max-height: 100px; max-height: 100px;
overflow: scroll; overflow: scroll;
border: solid 1px black; border: solid 1px black;
padding: 2em;
} }
</style> </style>
</head> </head>
@ -39,6 +40,7 @@
<h1 id="first-h1">Testing EPUB CFI</h1> <h1 id="first-h1">Testing EPUB CFI</h1>
<div id="current-cfi">Current CFI:&nbsp;None</div> <div id="current-cfi">Current CFI:&nbsp;None</div>
<h2>A div with scrollbars</h2> <h2>A div with scrollbars</h2>
<p>Scroll down and click on some elements. Make sure to hit both bold and not bold text</p>
<div id="overflow"> But I must explain to you how all this mistaken <div id="overflow"> But I must explain to you how all this mistaken
idea of denouncing pleasure and praising pain was born and I idea of denouncing pleasure and praising pain was born and I
will give you a complete account of the system, and expound the will give you a complete account of the system, and expound the
@ -60,6 +62,9 @@
demoralized by the charms of pleasure of the moment, so blinded demoralized by the charms of pleasure of the moment, so blinded
by desire, that they cannot foresee by desire, that they cannot foresee
</div> </div>
<h2>Some entities</h2>
<p>Entities: &amp; &copy; &sect; &gt;</p>
<p>An invisible CDATA: <![CDATA[CDATA]]> followed by some text</p>
</div> </div>
<img id="marker" style="position: absolute; display:none; z-index:10" src="marker.png" alt="Marker" /> <img id="marker" style="position: absolute; display:none; z-index:10" src="marker.png" alt="Marker" />
</body> </body>

View File

@ -18,7 +18,7 @@ except ImportError:
def run_devel_server(): def run_devel_server():
os.chdir(os.path.dirname(os.path.abspath(__file__))) os.chdir(os.path.dirname(os.path.abspath(__file__)))
serve(resources={'cfi.coffee':'../cfi.coffee'}) serve(resources={'cfi.coffee':'../cfi.coffee', '/':'index.html'})
if __name__ == '__main__': if __name__ == '__main__':
run_devel_server() run_devel_server()

View File

@ -41,6 +41,10 @@ class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
return SimpleHTTPServer.SimpleHTTPRequestHandler.translate_path(self, return SimpleHTTPServer.SimpleHTTPRequestHandler.translate_path(self,
path) path)
def guess_type(self, path):
ans = SimpleHTTPServer.SimpleHTTPRequestHandler.guess_type(self, path)
return ans
def newer(self, src, dest): def newer(self, src, dest):
try: try:
sstat = os.stat(src) sstat = os.stat(src)